File
Import :
const File = brackets.getModule("filesystem/File")
File
Kind: global class
new File(fullPath, fileSystem)
Model for a File.
This class should not be instantiated directly. Use FileSystem.getFileForPath, FileSystem.resolve, or Directory.getContents to create an instance of this class.
See the FileSystem class for more details.
Param | Type | Description |
---|---|---|
fullPath | string | The full path for this File. |
fileSystem | FileSystem | The file system associated with this File. |
file.read(options, callback)
Read a file.
Kind: instance method of File
Param | Type | Description |
---|---|---|
options | Object | |
[options.encoding] | string | 'one of format supported here: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding' |
[options.ignoreFileSizeLimits] | boolean | by default max file size that can be read is 16MB. |
[options.doNotCache] | boolean | will not cache if enabled. Auto-enabled if ignoreFileSizeLimits = true |
callback | function | Callback that is passed the FileSystemError string or the file's contents and its stats. |
file.write(data, [options], [callback])
Write a file.
Kind: instance method of File
Param | Type | Description |
---|---|---|
data | string | Data to write. |
[options] | Object | properties {encoding: 'one of format supported here: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding'} |
[callback] | function | Callback that is passed the FileSystemError string or the file's new stats. |