// create an empty dir and a file, then add the file to the dir constemptyDirCid = awaitfs.addDirectory() constfileCid = awaitfs.addBytes(Uint8Array.from([0, 1, 2, 3])) constupdateDirCid = awaitfs.cp(fileCid, emptyDirCid, 'foo.txt')
// or doing the same thing as a stream forawait (constentryoffs.addAll([{ path:'foo.txt', content:Uint8Array.from([0, 1, 2, 3]) }])) { console.info(entry) }
@helia/unixfs
is an implementation of a filesystem compatible with Helia.See the API docs for all available operations.
Example: Creating files and directories
Example: Recursively adding a directory
Node.js-compatibly environments only: