@remix-run/file-storage 0.11.0 → 0.12.0

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 CHANGED
@@ -1,13 +1,17 @@
1
1
  # file-storage
2
2
 
3
- `file-storage` is a key/value interface for storing [`File` objects](https://developer.mozilla.org/en-US/docs/Web/API/File) in JavaScript. 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.
3
+ `file-storage` is a key/value interface for storing [`File` objects](https://developer.mozilla.org/en-US/docs/Web/API/File) in JavaScript.
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.
4
8
 
5
9
  ## Features
6
10
 
7
- - Simple, 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)
8
- - A generic `FileStorage` interface that works for various large object storage backends (can be adapted to AWS S3, Cloudflare R2, etc.)
9
- - Support streaming file content to and from storage
10
- - Preserves all `File` metadata including `file.name`, `file.type`, and `file.lastModified`
11
+ - **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
+ - **Generic Interface** - `FileStorage` interface that works for various large object storage backends (can be adapted to AWS S3, Cloudflare R2, etc.)
13
+ - **Streaming Support** - Stream file content to and from storage
14
+ - **Metadata Preservation** - Preserves all `File` metadata including `file.name`, `file.type`, and `file.lastModified`
11
15
 
12
16
  ## Installation
13
17
 
@@ -1,7 +1,7 @@
1
1
  import * as fs from 'node:fs';
2
2
  import * as fsp from 'node:fs/promises';
3
3
  import * as path from 'node:path';
4
- import { openFile, writeFile } from '@remix-run/lazy-file/fs';
4
+ import { openFile, writeFile } from '@remix-run/fs';
5
5
  /**
6
6
  * A `FileStorage` that is backed by a directory on the local filesystem.
7
7
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix-run/file-storage",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Key/value storage for JavaScript File objects",
5
5
  "author": "Michael Jackson <mjijackson@gmail.com>",
6
6
  "repository": {
@@ -34,7 +34,8 @@
34
34
  "./package.json": "./package.json"
35
35
  },
36
36
  "peerDependencies": {
37
- "@remix-run/lazy-file": "^3.7.0"
37
+ "@remix-run/fs": "^0.1.0",
38
+ "@remix-run/lazy-file": "^4.0.0"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@types/node": "^24.6.0",
@@ -1,7 +1,7 @@
1
1
  import * as fs from 'node:fs'
2
2
  import * as fsp from 'node:fs/promises'
3
3
  import * as path from 'node:path'
4
- import { openFile, writeFile } from '@remix-run/lazy-file/fs'
4
+ import { openFile, writeFile } from '@remix-run/fs'
5
5
 
6
6
  import type { FileStorage, FileMetadata, ListOptions, ListResult } from './file-storage.ts'
7
7