@tus/file-store
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -1,4 +0,1 @@ | ||
export { FileConfigstore } from './FileConfigstore'; | ||
export { MemoryConfigstore } from './MemoryConfigstore'; | ||
export { RedisConfigstore } from './RedisConfigstore'; | ||
export { Configstore } from './Types'; | ||
export { FileKvStore as FileConfigstore, MemoryKvStore as MemoryConfigstore, RedisKvStore as RedisConfigstore, KvStore as Configstore, } from '@tus/utils'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RedisConfigstore = exports.MemoryConfigstore = exports.FileConfigstore = void 0; | ||
var FileConfigstore_1 = require("./FileConfigstore"); | ||
Object.defineProperty(exports, "FileConfigstore", { enumerable: true, get: function () { return FileConfigstore_1.FileConfigstore; } }); | ||
var MemoryConfigstore_1 = require("./MemoryConfigstore"); | ||
Object.defineProperty(exports, "MemoryConfigstore", { enumerable: true, get: function () { return MemoryConfigstore_1.MemoryConfigstore; } }); | ||
var RedisConfigstore_1 = require("./RedisConfigstore"); | ||
Object.defineProperty(exports, "RedisConfigstore", { enumerable: true, get: function () { return RedisConfigstore_1.RedisConfigstore; } }); | ||
var utils_1 = require("@tus/utils"); | ||
Object.defineProperty(exports, "FileConfigstore", { enumerable: true, get: function () { return utils_1.FileKvStore; } }); | ||
Object.defineProperty(exports, "MemoryConfigstore", { enumerable: true, get: function () { return utils_1.MemoryKvStore; } }); | ||
Object.defineProperty(exports, "RedisConfigstore", { enumerable: true, get: function () { return utils_1.RedisKvStore; } }); |
@@ -8,3 +8,3 @@ /// <reference types="node" /> | ||
import { Configstore } from './configstores'; | ||
import { DataStore, Upload } from '@tus/server'; | ||
import { DataStore, Upload } from '@tus/utils'; | ||
export * from './configstores'; | ||
@@ -11,0 +11,0 @@ type Options = { |
@@ -28,3 +28,3 @@ "use strict"; | ||
const configstores_1 = require("./configstores"); | ||
const server_1 = require("@tus/server"); | ||
const utils_1 = require("@tus/utils"); | ||
__exportStar(require("./configstores"), exports); | ||
@@ -35,3 +35,3 @@ const MASK = '0777'; | ||
const log = (0, debug_1.default)('tus-node-server:stores:filestore'); | ||
class FileStore extends server_1.DataStore { | ||
class FileStore extends utils_1.DataStore { | ||
constructor({ directory, configstore, expirationPeriodInMilliseconds }) { | ||
@@ -56,3 +56,3 @@ super(); | ||
checkOrCreateDirectory() { | ||
node_fs_1.default.mkdir(this.directory, MASK, (error) => { | ||
node_fs_1.default.mkdir(this.directory, { mode: MASK, recursive: true }, (error) => { | ||
if (error && error.code !== IGNORED_MKDIR_ERROR) { | ||
@@ -81,3 +81,3 @@ throw error; | ||
log('[FileStore] delete: Error', err); | ||
reject(server_1.ERRORS.FILE_NOT_FOUND); | ||
reject(utils_1.ERRORS.FILE_NOT_FOUND); | ||
return; | ||
@@ -111,3 +111,3 @@ } | ||
log('[FileStore] write: Error', err); | ||
return reject(server_1.ERRORS.FILE_WRITE_ERROR); | ||
return reject(utils_1.ERRORS.FILE_WRITE_ERROR); | ||
} | ||
@@ -124,3 +124,3 @@ log(`[FileStore] write: ${bytes_received} bytes written to ${file_path}`); | ||
if (!file) { | ||
throw server_1.ERRORS.FILE_NOT_FOUND; | ||
throw utils_1.ERRORS.FILE_NOT_FOUND; | ||
} | ||
@@ -132,7 +132,7 @@ return new Promise((resolve, reject) => { | ||
log(`[FileStore] getUpload: No file found at ${file_path} but db record exists`, file); | ||
return reject(server_1.ERRORS.FILE_NO_LONGER_EXISTS); | ||
return reject(utils_1.ERRORS.FILE_NO_LONGER_EXISTS); | ||
} | ||
if (error && error.code === FILE_DOESNT_EXIST) { | ||
log(`[FileStore] getUpload: No file found at ${file_path}`); | ||
return reject(server_1.ERRORS.FILE_NOT_FOUND); | ||
return reject(utils_1.ERRORS.FILE_NOT_FOUND); | ||
} | ||
@@ -144,5 +144,5 @@ if (error) { | ||
log(`[FileStore] getUpload: ${file_path} is a directory`); | ||
return reject(server_1.ERRORS.FILE_NOT_FOUND); | ||
return reject(utils_1.ERRORS.FILE_NOT_FOUND); | ||
} | ||
return resolve(new server_1.Upload({ | ||
return resolve(new utils_1.Upload({ | ||
id, | ||
@@ -160,3 +160,3 @@ size: file.size, | ||
if (!file) { | ||
throw server_1.ERRORS.FILE_NOT_FOUND; | ||
throw utils_1.ERRORS.FILE_NOT_FOUND; | ||
} | ||
@@ -170,3 +170,3 @@ file.size = upload_length; | ||
if (!this.configstore.list) { | ||
throw server_1.ERRORS.UNSUPPORTED_EXPIRATION_EXTENSION; | ||
throw utils_1.ERRORS.UNSUPPORTED_EXPIRATION_EXTENSION; | ||
} | ||
@@ -190,3 +190,3 @@ const uploadKeys = await this.configstore.list(); | ||
catch (error) { | ||
if (error !== server_1.ERRORS.FILE_NO_LONGER_EXISTS) { | ||
if (error !== utils_1.ERRORS.FILE_NO_LONGER_EXISTS) { | ||
throw error; | ||
@@ -193,0 +193,0 @@ } |
{ | ||
"$schema": "https://json.schemastore.org/package.json", | ||
"name": "@tus/file-store", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Local file storage for @tus/server", | ||
@@ -24,6 +24,6 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@tus/utils": "workspace:*", | ||
"debug": "^4.3.4" | ||
}, | ||
"devDependencies": { | ||
"@tus/server": "^1.2.0", | ||
"@types/debug": "^4.1.12", | ||
@@ -33,3 +33,3 @@ "@types/mocha": "^10.0.6", | ||
"eslint": "^8.56.0", | ||
"eslint-config-custom": "0.0.0", | ||
"eslint-config-custom": "workspace:*", | ||
"mocha": "^10.2.0", | ||
@@ -39,5 +39,2 @@ "should": "^13.2.3", | ||
}, | ||
"peerDependencies": { | ||
"@tus/server": "^1.2.0" | ||
}, | ||
"optionalDependencies": { | ||
@@ -49,2 +46,2 @@ "@redis/client": "^1.5.13" | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8
22877
407
+ Added@tus/utils@workspace:*
- Removed@tus/server@1.8.0(transitive)
- Removed@tus/utils@0.4.0(transitive)
- Removedlodash.throttle@4.1.1(transitive)