MCPcopy
hub / github.com/jvilk/BrowserFS / createFile

Method createFile

src/generic/key_value_filesystem.ts:878–887  ·  view source on GitHub ↗
(p: string, flag: FileFlag, mode: number, cb: BFSCallback<File>)

Source from the content-addressed store, hash-verified

876 }
877
878 public createFile(p: string, flag: FileFlag, mode: number, cb: BFSCallback<File>): void {
879 const tx = this.store.beginTransaction('readwrite'),
880 data = emptyBuffer();
881
882 this.commitNewFile(tx, p, FileType.FILE, mode, data, (e: ApiError, newFile?: Inode): void => {
883 if (noError(e, cb)) {
884 cb(null, new AsyncKeyValueFile(this, p, flag, newFile!.toStats(), data));
885 }
886 });
887 }
888
889 public openFile(p: string, flag: FileFlag, cb: BFSCallback<File>): void {
890 const tx = this.store.beginTransaction('readonly');

Callers

nothing calls this directly

Calls 6

commitNewFileMethod · 0.95
emptyBufferFunction · 0.90
noErrorFunction · 0.85
cbFunction · 0.85
toStatsMethod · 0.80
beginTransactionMethod · 0.65

Tested by

no test coverage detected