A simple promise-based wrapper for file operations that treats files as objects.
Package Exports
fobject
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fobject) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
fobject
A simple promise-based wrapper for file operations that treats files as objects.
File = require 'fobject'
configFile = new File('config.json')
configFile.read().done((data) ->
console.log "contents of #{configFile.path}: #{data}"
)
why?
The default fs module has a really ugly interface (including sync and async copies of almost every function) and doesn't make it easy to work with files that may or may not actually be written to the file-system. fobject abstracts out interaction with the file system so if you want to implement caching, or work with files without writing them to the disk, or whatever else you want: you can do so easily.
docs
new File(path)
Parameters:
Name
Type
Argument
Default
Description
path
String
The path to the file. This will be resolved to an
absolute path, so even if you change your cwd you can still access the same
file.
options.base
String
<optional>
./
Used for relative pathing. This will not
be resolved to an absolute path. Typically where a glob starts.