FileAccess, v2.0.1

Access the contents of files that the user has selected.

Other Versions

2.0.1, 1.0.11, 1.0.9, 1.0.8, 1.0.6, 1.0.5

BrowserPlus.FileAccess.read({params}, function{}())

Read the contents of a file on disk returning a string. If the file contains binary data an error will be returned.

Test: read()

Parameters

file: path
The input file to operate on.
offset: integer (Optional)
The beginning byte offset.
size: integer (Optional)
The amount of data.

BrowserPlus.FileAccess.slice({params}, function{}())

Given a file and an optional offset and size, return a new file whose contents are a subset of the first.

Test: slice()

Parameters

file: path
The input file to operate on.
offset: integer (Optional)
The beginning byte offset.
size: integer (Optional)
The amount of data.

BrowserPlus.FileAccess.getURL({params}, function{}())

Get a localhost url that can be used to attain the full contents of a file on disk. The URL will be of the form http://127.0.0.1:<port>/<uuid> -- The port will be an ephemerally bound port, the uuid will be a traditional GUID. When a local client accesses the URL, the FileAccess service will ignore any appended pathing (i.e. for http://127.0.0.1:<port>/<uuid>/foo.tar.gz, '/foo.tar.gz' will be ignored). This allows client code to supply a filename when triggering a browser supplied 'save as' dialog.

Test: getURL()

Parameters

file: path
The file that you would like to read via a localhost url.

BrowserPlus.FileAccess.chunk({params}, function{}())

Get a vector of objects that result from chunking a file. The return value will be an ordered list of file handles with each successive file representing a different chunk

Test: chunk()

Parameters

file: path
The file that you would like to chunk.
chunkSize: integer (Optional)
The desired chunk size, not to exceed 2MB. Default is 2MB.