image-resizing
Advanced tools
Comparing version 0.1.2 to 0.2.0-next.1
@@ -65,3 +65,5 @@ "use strict"; | ||
var sourceFile = target ? cacheBucket.file("".concat(cachePrefix).concat(target)) : sourceBucket.file("".concat(sourcePrefix).concat(source)); | ||
var sourcePath = "".concat(sourcePrefix).concat(source); | ||
var cachedPath = "".concat(cachePrefix).concat(target); | ||
var sourceFile = target ? cacheBucket.file(cachedPath) : sourceBucket.file(sourcePath); | ||
sourceFile.createReadStream({ | ||
@@ -76,4 +78,7 @@ decompress: false | ||
} else if (x.statusCode === 404) { | ||
var _options$read; | ||
this.end(); | ||
sourceBucket.file("".concat(sourcePrefix).concat(source)).createReadStream().on("error", _utils.noop).on("response", function (x) { | ||
var fs = ((_options$read = options.read) === null || _options$read === void 0 ? void 0 : _options$read.call(options, sourcePath)) || sourceBucket.file(sourcePath).createReadStream(); | ||
fs.on("error", _utils.noop).on("response", function (x) { | ||
if (x.statusCode === 200) { | ||
@@ -85,3 +90,3 @@ res.set("Cache-Control", cacheControlInitial); | ||
} else { | ||
var targetFile = cacheBucket.file("".concat(cachePrefix).concat(target)).createWriteStream({ | ||
var cachedFile = cacheBucket.file(cachedPath).createWriteStream({ | ||
contentType: x.headers["content-type"] | ||
@@ -91,3 +96,3 @@ }).on("error", function (err) { | ||
}); | ||
out.pipe(targetFile); | ||
out.pipe(cachedFile); | ||
out.pipe(res); | ||
@@ -94,0 +99,0 @@ } |
/** | ||
* Copyright (c) 2020-present Kriasoft | MIT License (https://git.io/JUgVL) | ||
*/ | ||
/// <reference types="node" /> | ||
import { StorageOptions } from "@google-cloud/storage"; | ||
import type { Readable } from "stream"; | ||
export declare type Transform = { | ||
@@ -25,2 +27,3 @@ width?: number; | ||
readonly params?: Params; | ||
readonly read?: (path: string) => Readable | null | undefined; | ||
}; | ||
@@ -27,0 +30,0 @@ export declare type ParsedOutput = Readonly<{ |
{ | ||
"name": "image-resizing", | ||
"version": "0.1.2", | ||
"version": "0.2.0-next.1", | ||
"description": "Node.js backend (middleware) for image manipulation needs (transform, resize, optimize).", | ||
@@ -35,6 +35,7 @@ "keywords": [ | ||
"scripts": { | ||
"test": "jest --env=node", | ||
"build": "babel --env-name=production --source-maps --out-dir ./lib --verbose --delete-dir-on-start --extensions \".ts\" ./src && tsc --emitDeclarationOnly && yarn pack" | ||
}, | ||
"dependencies": { | ||
"@google-cloud/storage": "^5.3.0", | ||
"@google-cloud/storage": "^5.4.0", | ||
"@types/express": "^4.17.8", | ||
@@ -44,22 +45,22 @@ "gm": "^1.23.1" | ||
"devDependencies": { | ||
"@babel/cli": "^7.11.6", | ||
"@babel/core": "^7.11.6", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.11.0", | ||
"@babel/plugin-transform-runtime": "^7.11.5", | ||
"@babel/preset-env": "^7.11.5", | ||
"@babel/preset-typescript": "^7.10.4", | ||
"@babel/cli": "^7.12.1", | ||
"@babel/core": "^7.12.3", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.12.1", | ||
"@babel/plugin-transform-runtime": "^7.12.1", | ||
"@babel/preset-env": "^7.12.1", | ||
"@babel/preset-typescript": "^7.12.1", | ||
"@types/gm": "^1.18.9", | ||
"@types/jest": "^26.0.14", | ||
"@types/jest-image-snapshot": "^4.1.0", | ||
"@typescript-eslint/eslint-plugin": "^4.2.0", | ||
"@typescript-eslint/parser": "^4.2.0", | ||
"babel-jest": "^26.3.0", | ||
"@types/jest": "^26.0.15", | ||
"@types/jest-image-snapshot": "^4.1.2", | ||
"@typescript-eslint/eslint-plugin": "^4.6.0", | ||
"@typescript-eslint/parser": "^4.6.0", | ||
"babel-jest": "^26.6.1", | ||
"cross-spawn": "^7.0.3", | ||
"eslint": "^7.9.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint": "^7.12.1", | ||
"eslint-config-prettier": "^6.15.0", | ||
"express": "^4.17.1", | ||
"jest": "^26.4.2", | ||
"jest": "^26.6.1", | ||
"jest-image-snapshot": "^4.2.0", | ||
"prettier": "^2.1.2", | ||
"typescript": "^4.0.3" | ||
"typescript": "^4.0.5" | ||
}, | ||
@@ -66,0 +67,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
46408
394
Updated@google-cloud/storage@^5.4.0