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

Method completeRename

src/generic/key_value_filesystem.ts:791–809  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

789 // Finishes off the renaming process by adding the file to the new
790 // parent.
791 const completeRename = () => {
792 newParentList[newName] = fileId;
793 // Commit old parent's list.
794 tx.put(oldParentINode.id, Buffer.from(JSON.stringify(oldParentList)), true, (e: ApiError) => {
795 if (noErrorTx(e, tx, cb)) {
796 if (oldParent === newParent) {
797 // DONE!
798 tx.commit(cb);
799 } else {
800 // Commit new parent's list.
801 tx.put(newParentINode.id, Buffer.from(JSON.stringify(newParentList)), true, (e: ApiError) => {
802 if (noErrorTx(e, tx, cb)) {
803 tx.commit(cb);
804 }
805 });
806 }
807 }
808 });
809 };
810
811 if (newParentList[newName]) {
812 // 'newPath' already exists. Check if it's a file or a directory, and

Callers

nothing calls this directly

Calls 3

noErrorTxFunction · 0.85
putMethod · 0.65
commitMethod · 0.65

Tested by

no test coverage detected