Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tus/file-store

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tus/file-store - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

24

dist/index.js

@@ -23,2 +23,3 @@ "use strict";

const node_fs_1 = __importDefault(require("node:fs"));
const promises_1 = __importDefault(require("node:fs/promises"));
const node_path_1 = __importDefault(require("node:path"));

@@ -63,19 +64,8 @@ const node_stream_1 = __importDefault(require("node:stream"));

*/
create(file) {
return new Promise((resolve, reject) => {
node_fs_1.default.open(node_path_1.default.join(this.directory, file.id), 'w', async (err, fd) => {
if (err) {
log('[FileStore] create: Error', err);
return reject(err);
}
await this.configstore.set(file.id, file);
return node_fs_1.default.close(fd, (exception) => {
if (exception) {
log('[FileStore] create: Error', exception);
return reject(exception);
}
return resolve(file);
});
});
});
async create(file) {
const dirs = file.id.split('/').slice(0, -1);
await promises_1.default.mkdir(node_path_1.default.join(this.directory, ...dirs), { recursive: true });
await promises_1.default.writeFile(node_path_1.default.join(this.directory, file.id), '');
await this.configstore.set(file.id, file);
return file;
}

@@ -82,0 +72,0 @@ read(file_id) {

{
"$schema": "https://json.schemastore.org/package.json",
"name": "@tus/file-store",
"version": "1.1.0",
"version": "1.2.0",
"description": "Local file storage for @tus/server",

@@ -27,17 +27,17 @@ "main": "dist/index.js",

"devDependencies": {
"@tus/server": "^1.0.1",
"@types/debug": "^4.1.8",
"@types/mocha": "^10.0.1",
"@types/node": "^20.5.7",
"eslint": "^8.48.0",
"@tus/server": "^1.2.0",
"@types/debug": "^4.1.12",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.5",
"eslint": "^8.56.0",
"eslint-config-custom": "0.0.0",
"mocha": "^10.2.0",
"should": "^13.2.3",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
},
"peerDependencies": {
"@tus/server": "^1.0.1"
"@tus/server": "^1.2.0"
},
"optionalDependencies": {
"@redis/client": "^1.5.9"
"@redis/client": "^1.5.13"
},

@@ -44,0 +44,0 @@ "engines": {

@@ -56,5 +56,6 @@ # `@tus/file-store`

Provide your own storage solution for the metadata of uploads (`Class`).
Provide your own storage solution for the metadata of uploads ([`KvStore`][]).
Default uses [`configstore`](https://www.npmjs.com/package/configstore).
Default uses `FileKvStore` which puts the metadata file next to the uploaded file.
See the exported [KV stores][kvstores] from `@tus/server` for more information.

@@ -66,3 +67,3 @@ #### `options.expirationPeriodInMilliseconds`

This is since the time of creation, not modification. Once an upload is considered expired,
uploads can be removed with [`cleanUpExpiredUploads`](https://github.com/tus/tus-node-server/tree/main/packages/server#)#servercleanupexpireduploads
uploads can be removed with [`cleanUpExpiredUploads`][].

@@ -107,3 +108,3 @@ ## Extensions

get all(): Record<string, Upload> {
get list(): Record<string, Upload> {
return Object.fromEntries(this.data.entries())

@@ -145,1 +146,4 @@ }

[concatenation]: https://tus.io/protocols/resumable-upload.html#concatenation
[`cleanUpExpiredUploads`]: https://github.com/tus/tus-node-server/tree/main/packages/server#cleanupexpireduploads
[kvstores]: https://github.com/tus/tus-node-server/tree/main/packages/server#kvstores
[`KvStore`]: https://github.com/tus/tus-node-server/blob/main/packages/server/src/kvstores/Types.ts
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc