Skip to main content

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.

ParamTypeDescription
fullPathstringThe full path for this File.
fileSystemFileSystemThe file system associated with this File.

file.read([options], callback)

Read a file.

Kind: instance method of File

ParamTypeDescription
[options]Objectproperties {encoding: 'one of format supported here: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding'}
callbackfunctionCallback 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

ParamTypeDescription
datastringData to write.
[options]Objectproperties {encoding: 'one of format supported here: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding'}
[callback]functionCallback that is passed the FileSystemError string or the file's new stats.