Feature #177
Create @module.resource@ API
| Status: | Closed | Start: | 12/02/2009 | |
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 100% |
||
| Category: | Javascript-API | |||
| Target version: | 0.9 | |||
Description
Getting hold of a file relative to the current module in a generic way involves doing some nasty regexen on module.uri.
So lets give a nicer way to do this:
module.resource(name[, mode[, permissions]]) -> io.Stream module.resource.resolve(name) -> String
This has been hinted at a number of times in CommonJS, but hasn't yet been even proposed. I want it, so I'm JFDingIt.
Associated revisions
Revision 190013d3c646d4d3c1020221784b70f8c070ab4d
core/modules: Implement module.resource (closes #177)
While I was in there I fixed a few odities with when require.main.id was set, specifically it is now always set, even for simple repls.
History
Updated by Ash Berlin 239 days ago
Kris Kowal suggested on irc the following API:
module.resource(id) -> fs.Path
which would be our .resolve as above, and then module.resource(id).open() would our resource. But we dont yet have Path objects, so this can happen latter :)
Updated by Ash Berlin 239 days ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100