createFile
Create a new file in a BrowserPod Pod's virtual filesystem, returning a BinaryFile or TextFile handle depending on the mode you pass.
class BrowserPod { async createFile(path: string, mode: string): Promise<BinaryFile | TextFile>;}Parameters
- path (
string) - Path of the newly-created file. - mode (
string) - Opening mode. Either “binary” or “utf-8”.
Returns
createFile returns a Promise which resolves to a BinaryFile object if
mode="binary", and to a TextFile object if mode="utf-8".
If the file could not be created, the Promise will be rejected.
Calling createFile on an already existing file will wipe its contents.