MCPcopy Index your code
hub / github.com/jvilk/BrowserFS / empty

Method empty

src/backend/Dropbox.ts:423–445  ·  view source on GitHub ↗
(mainCb: BFSOneArgCallback)

Source from the content-addressed store, hash-verified

421 }
422
423 public empty(mainCb: BFSOneArgCallback): void {
424 this._client.readdir('/', (error, files) => {
425 if (error) {
426 mainCb(this.convert(error, '/'));
427 } else {
428 const deleteFile = (file: string, cb: BFSOneArgCallback) => {
429 const p = path.join('/', file);
430 this._client.remove(p, (err) => {
431 cb(err ? this.convert(err, p) : null);
432 });
433 };
434 const finished = (err?: ApiError) => {
435 if (err) {
436 mainCb(err);
437 } else {
438 mainCb();
439 }
440 };
441 // XXX: <any> typing is to get around overly-restrictive ErrorCallback typing.
442 asyncEach(files!, <any> deleteFile, <any> finished);
443 }
444 });
445 }
446
447 public rename(oldPath: string, newPath: string, cb: BFSOneArgCallback): void {
448 this._client.move(oldPath, newPath, (error) => {

Callers

nothing calls this directly

Calls 2

convertMethod · 0.95
readdirMethod · 0.65

Tested by

no test coverage detected