@b9g/filesystem 0.1.10 → 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/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": {
|