MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / ply_storage_resolve_root

Function ply_storage_resolve_root

js/storage.js:46–61  ·  view source on GitHub ↗
(root_path)

Source from the content-addressed store, hash-verified

44}
45
46async function ply_storage_resolve_root(root_path) {
47 if (!navigator.storage || !navigator.storage.getDirectory) {
48 throw new Error("OPFS is not available in this browser");
49 }
50
51 var handle = await navigator.storage.getDirectory();
52 var parts = root_path.split('/').filter(function (part) {
53 return part.length > 0;
54 });
55
56 for (var i = 0; i < parts.length; i += 1) {
57 handle = await handle.getDirectoryHandle(parts[i], { create: true });
58 }
59
60 return handle;
61}
62
63async function ply_storage_resolve_parent_dir(root_handle, relative_path, create_dirs) {
64 var parts = ply_storage_split_path(relative_path);

Callers 1

ply_storage_newFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected