From 9146bb53746e42d424385b8d9913f202b15a42b3 Mon Sep 17 00:00:00 2001 From: Arne de Bruijn Date: Thu, 9 Dec 2021 19:58:50 +0100 Subject: [PATCH] Update file-type to 16.3.0 Needed for zstd detection. --- lib/source-destination/source-destination.ts | 6 +- package-lock.json | 59 +++++++++++++++++++- package.json | 2 +- 3 files changed, 60 insertions(+), 7 deletions(-) diff --git a/lib/source-destination/source-destination.ts b/lib/source-destination/source-destination.ts index 126aa4df..d97dfbc5 100644 --- a/lib/source-destination/source-destination.ts +++ b/lib/source-destination/source-destination.ts @@ -17,7 +17,7 @@ import { Transform as TransformStream } from 'stream'; import { EventEmitter } from 'events'; import { ReadResult, WriteResult } from 'file-disk'; -import * as fileType from 'file-type'; +import { fromBuffer as fileTypeFromBuffer } from 'file-type'; import { getPartitions, GetPartitionsResult } from 'partitioninfo'; import { extname } from 'path'; import { XXHash3 } from 'xxhash-addon'; @@ -471,8 +471,8 @@ export class SourceDestination extends EventEmitter { } throw error; } - const ft = fileType(await streamToBuffer(stream)); - if (ft !== null) { + const ft = await fileTypeFromBuffer(await streamToBuffer(stream)); + if (ft !== null && ft !== undefined) { return ft.mime; } } diff --git a/package-lock.json b/package-lock.json index d727a74c..741a47a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -891,6 +891,11 @@ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", "dev": true }, + "@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" + }, "@types/aws4": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/@types/aws4/-/aws4-1.11.0.tgz", @@ -1955,9 +1960,14 @@ } }, "file-type": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-8.1.0.tgz", - "integrity": "sha512-qyQ0pzAy78gVoJsmYeNgl8uH8yKhr1lVhW7JbzJmnlRi0I4R2eEDEJZVKG8agpDnLpacwNbDhLNG/LMdxHD2YQ==" + "version": "16.5.3", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.3.tgz", + "integrity": "sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A==", + "requires": { + "readable-web-to-node-stream": "^3.0.0", + "strtok3": "^6.2.4", + "token-types": "^4.1.1" + } }, "file-uri-to-path": { "version": "1.0.0", @@ -4833,6 +4843,11 @@ "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true }, + "peek-readable": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.0.1.tgz", + "integrity": "sha512-7qmhptnR0WMSpxT5rMHG9bW/mYSR1uqaPFj2MHvT+y/aOUu6msJijpKt5SkTDKySwg65OWG2JwTMBlgcbwMHrQ==" + }, "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -4966,6 +4981,26 @@ "util-deprecate": "~1.0.1" } }, + "readable-web-to-node-stream": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", + "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", + "requires": { + "readable-stream": "^3.6.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -5229,6 +5264,15 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, + "strtok3": { + "version": "6.2.4", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.2.4.tgz", + "integrity": "sha512-GO8IcFF9GmFDvqduIspUBwCzCbqzegyVKIsSymcMgiZKeCfrN9SowtUoi8+b59WZMAjIzVZic/Ft97+pynR3Iw==", + "requires": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^4.0.1" + } + }, "struct-fu": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/struct-fu/-/struct-fu-1.2.1.tgz", @@ -5303,6 +5347,15 @@ "is-number": "^7.0.0" } }, + "token-types": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.1.1.tgz", + "integrity": "sha512-hD+QyuUAyI2spzsI0B7gf/jJ2ggR4RjkAo37j3StuePhApJUwcWDjnHDOFdIWYSwNR28H14hpwm4EI+V1Ted1w==", + "requires": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + } + }, "traverse": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", diff --git a/package.json b/package.json index 6a60955f..c1b75987 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "debug": "^3.1.0", "drivelist": "^9.2.4", "file-disk": "^8.0.1", - "file-type": "^8.0.0", + "file-type": "^16.3.0", "gzip-stream": "^1.1.2", "lzma-native": "git+https://github.com/thundron/lzma-native.git", "mountutils": "^1.3.20",