@b9g/filesystem 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/package.json +2 -2
- package/src/bun-s3.d.ts +1 -0
- package/src/bun-s3.js +3 -1
- package/src/memory.d.ts +1 -1
- package/src/memory.js +3 -1
- package/src/node-fs.d.ts +1 -0
- package/src/node-fs.js +3 -1
package/README.md
CHANGED
|
@@ -182,6 +182,33 @@ const buffer = await fileData.arrayBuffer();
|
|
|
182
182
|
const stream = fileData.stream();
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
+
## Shovel Configuration
|
|
186
|
+
|
|
187
|
+
When used with Shovel, directories are configured in `shovel.json`. The built-in names `server`, `public`, and `tmp` have platform defaults. Custom directory names require an explicit `module`:
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"directories": {
|
|
192
|
+
"uploads": {
|
|
193
|
+
"module": "@b9g/filesystem/node-fs",
|
|
194
|
+
"path": "./uploads"
|
|
195
|
+
},
|
|
196
|
+
"docs": {
|
|
197
|
+
"module": "@b9g/filesystem/node-fs",
|
|
198
|
+
"path": "../docs"
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The `path` field is resolved relative to the project root. Paths outside the project (e.g. `"../docs"`) are supported — the root path itself is unrestricted, while directory traversal within opened directories is blocked at the filesystem level.
|
|
205
|
+
|
|
206
|
+
Access configured directories via the global `self.directories`:
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
const uploads = await self.directories.open("uploads");
|
|
210
|
+
```
|
|
211
|
+
|
|
185
212
|
## Integration Examples
|
|
186
213
|
|
|
187
214
|
### Cache Storage
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b9g/filesystem",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Universal File System Access API implementations for all platforms",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/bikeshaving/shovel.git",
|
|
8
|
+
"url": "git+https://github.com/bikeshaving/shovel.git",
|
|
9
9
|
"directory": "packages/filesystem"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
package/src/bun-s3.d.ts
CHANGED
package/src/bun-s3.js
CHANGED
package/src/memory.d.ts
CHANGED
package/src/memory.js
CHANGED
|
@@ -263,7 +263,9 @@ var MemoryDirectory = class _MemoryDirectory {
|
|
|
263
263
|
return "granted";
|
|
264
264
|
}
|
|
265
265
|
};
|
|
266
|
+
var memory_default = MemoryDirectory;
|
|
266
267
|
export {
|
|
267
268
|
MemoryDirectory,
|
|
268
|
-
MemoryFileSystemBackend
|
|
269
|
+
MemoryFileSystemBackend,
|
|
270
|
+
memory_default as default
|
|
269
271
|
};
|
package/src/node-fs.d.ts
CHANGED
package/src/node-fs.js
CHANGED
|
@@ -156,7 +156,9 @@ var NodeFSDirectory = class extends ShovelDirectoryHandle {
|
|
|
156
156
|
return Path.basename(this.#rootPath) || "root";
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
|
+
var node_fs_default = NodeFSDirectory;
|
|
159
160
|
export {
|
|
160
161
|
NodeFSBackend,
|
|
161
|
-
NodeFSDirectory
|
|
162
|
+
NodeFSDirectory,
|
|
163
|
+
node_fs_default as default
|
|
162
164
|
};
|