@remix-run/file-storage 0.13.1 → 0.13.3
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 +5 -10
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
# file-storage
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Handling file uploads and storage is a common requirement in web applications, but each storage backend (local disk, AWS S3, Cloudflare R2, etc.) has its own API and conventions. This fragmentation makes it difficult to write portable code that can easily switch between storage providers or support multiple backends simultaneously.
|
|
6
|
-
|
|
7
|
-
Similar to how `localStorage` allows you to store key/value pairs of strings in the browser, `file-storage` allows you to store key/value pairs of files on the server with a consistent interface regardless of the underlying storage mechanism.
|
|
3
|
+
Key/value storage interfaces for server-side [`File` objects](https://developer.mozilla.org/en-US/docs/Web/API/File). `file-storage` gives Remix apps one consistent API across local disk and memory backends.
|
|
8
4
|
|
|
9
5
|
## Features
|
|
10
6
|
|
|
11
7
|
- **Simple API** - Intuitive key/value API (like [Web Storage](https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API), but for `File`s instead of strings)
|
|
12
|
-
- **
|
|
8
|
+
- **Multiple Backends** - Built-in filesystem and memory backends
|
|
13
9
|
- **Streaming Support** - Stream file content to and from storage
|
|
14
10
|
- **Metadata Preservation** - Preserves all `File` metadata including `file.name`, `file.type`, and `file.lastModified`
|
|
15
11
|
|
|
16
12
|
## Installation
|
|
17
13
|
|
|
18
|
-
Install from [npm](https://www.npmjs.com/):
|
|
19
|
-
|
|
20
14
|
```sh
|
|
21
|
-
npm
|
|
15
|
+
npm i remix
|
|
22
16
|
```
|
|
23
17
|
|
|
24
18
|
## Usage
|
|
@@ -26,7 +20,7 @@ npm install @remix-run/file-storage
|
|
|
26
20
|
### File System
|
|
27
21
|
|
|
28
22
|
```ts
|
|
29
|
-
import { createFsFileStorage } from '
|
|
23
|
+
import { createFsFileStorage } from 'remix/file-storage/fs'
|
|
30
24
|
|
|
31
25
|
let storage = createFsFileStorage('./user/files')
|
|
32
26
|
|
|
@@ -48,6 +42,7 @@ await storage.remove(key)
|
|
|
48
42
|
|
|
49
43
|
## Related Packages
|
|
50
44
|
|
|
45
|
+
- [`file-storage-s3`](https://github.com/remix-run/remix/tree/main/packages/file-storage-s3) - S3 backend for `file-storage`
|
|
51
46
|
- [`form-data-parser`](https://github.com/remix-run/remix/tree/main/packages/form-data-parser) - Pairs well with this library for storing `FileUpload` objects received in `multipart/form-data` requests
|
|
52
47
|
- [`lazy-file`](https://github.com/remix-run/remix/tree/main/packages/lazy-file) - The streaming `File` implementation used internally to stream files from storage
|
|
53
48
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remix-run/file-storage",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"description": "Key/value storage for JavaScript File objects",
|
|
5
5
|
"author": "Michael Jackson <mjijackson@gmail.com>",
|
|
6
6
|
"repository": {
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
},
|
|
34
34
|
"./package.json": "./package.json"
|
|
35
35
|
},
|
|
36
|
-
"
|
|
37
|
-
"@remix-run/fs": "^0.4.
|
|
38
|
-
"@remix-run/lazy-file": "^5.0.
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@remix-run/fs": "^0.4.2",
|
|
38
|
+
"@remix-run/lazy-file": "^5.0.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^24.6.0",
|
|
42
42
|
"@typescript/native-preview": "7.0.0-dev.20251125.1",
|
|
43
|
-
"@remix-run/form-data-parser": "0.
|
|
43
|
+
"@remix-run/form-data-parser": "0.15.0"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
|
46
46
|
"file",
|