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

@flmngr/flmngr-server-node

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flmngr/flmngr-server-node - npm Package Compare versions

Comparing version 1.5.1 to 1.5.2

3

dist/cjs/FlmngrServer.js

@@ -69,2 +69,5 @@ "use strict";

break;
case "fileResize2":
data = yield fileSystem.reqResizeFile2(config.request);
break;
case "fileResize":

@@ -71,0 +74,0 @@ data = yield fileSystem.reqResizeFile(config.request);

8

dist/cjs/fs/CachedFile.js

@@ -141,7 +141,7 @@ "use strict";

if (previewWidth == null) {
previewWidth = Math.floor(originalRatio * previewHeight);
previewWidth = Math.max(1, Math.floor(originalRatio * previewHeight));
}
else {
if (previewHeight === null) {
previewHeight = Math.floor((1 / originalRatio) * previewWidth);
previewHeight = Math.max(1, Math.floor((1 / originalRatio) * previewWidth));
}

@@ -151,6 +151,6 @@ }

if (originalRatio >= previewRatio) {
previewHeight = Math.floor(originalHeight * previewWidth / originalWidth);
previewHeight = Math.max(1, Math.floor(originalHeight * previewWidth / originalWidth));
}
else {
previewWidth = Math.floor(originalWidth * previewHeight / originalHeight);
previewWidth = Math.max(1, Math.floor(originalWidth * previewHeight / originalHeight));
}

@@ -157,0 +157,0 @@ image = image.resize(previewWidth, previewHeight);

@@ -69,2 +69,7 @@ /// <reference types="node" />

reqResizeFile(request: FlmngrRequest): Promise<string>;
reqResizeFile2(request: FlmngrRequest): Promise<{
url: string;
width: number;
height: number;
}>;
reqGetImageOriginal(request: FlmngrRequest): {

@@ -71,0 +76,0 @@ mimeType: string;

@@ -518,2 +518,7 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
return (yield this.reqResizeFile2(request)).url;
});
}
reqResizeFile2(request) {
return __awaiter(this, void 0, void 0, function* () {
let filePath = request.getParameterString("f");

@@ -536,2 +541,9 @@ let newFileNameWithoutExt = request.getParameterString("n");

let oldExt = Utils_1.Utils.getExt(filePath).toLowerCase();
if (oldExt === "svg") {
return {
url: filePath,
width: -1,
height: -1
};
}
if (oldExt === "jpg" || oldExt === "jpeg") {

@@ -552,3 +564,8 @@ newExt = "jpg";

if (mode === 'DO_NOT_UPDATE' && isDstPathExists) {
return dstPath;
let info = yield this.getCachedImagePreviewAndResolution(dstPath, this.driverFiles.get(dstPath));
return {
url: dstPath,
width: info.width,
height: info.height
};
}

@@ -583,3 +600,8 @@ let contents = this.driverFiles.get(filePath);

newFileNameWithoutExt + "." + oldExt === oldFileNameWithExt) {
return filePath;
let info = yield this.getCachedImagePreviewAndResolution(filePath, this.driverFiles.get(filePath));
return {
url: filePath,
width: info.width,
height: info.height
};
}

@@ -594,11 +616,15 @@ else {

ratio = width / originalWidth;
height = Math.floor(originalHeight * ratio);
height = Math.max(1, Math.floor(originalHeight * ratio));
}
else if (needToFitHeight) {
ratio = height / originalHeight;
width = Math.floor(originalWidth * ratio);
width = Math.max(1, Math.floor(originalWidth * ratio));
}
let resizedImage = image.resize(width, height);
this.driverFiles.put(dstPath, yield resizedImage.toFormat(newExt).toBuffer());
return dstPath;
return {
url: dstPath,
width: width,
height: height
};
});

@@ -621,4 +647,4 @@ }

return {
version: "5",
build: "1",
version: "6",
build: "3",
language: "node",

@@ -625,0 +651,0 @@ framework: framework || "custom",

@@ -66,2 +66,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

break;
case "fileResize2":
data = yield fileSystem.reqResizeFile2(config.request);
break;
case "fileResize":

@@ -68,0 +71,0 @@ data = yield fileSystem.reqResizeFile(config.request);

@@ -112,7 +112,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

if (previewWidth == null) {
previewWidth = Math.floor(originalRatio * previewHeight);
previewWidth = Math.max(1, Math.floor(originalRatio * previewHeight));
}
else {
if (previewHeight === null) {
previewHeight = Math.floor((1 / originalRatio) * previewWidth);
previewHeight = Math.max(1, Math.floor((1 / originalRatio) * previewWidth));
}

@@ -122,6 +122,6 @@ }

if (originalRatio >= previewRatio) {
previewHeight = Math.floor(originalHeight * previewWidth / originalWidth);
previewHeight = Math.max(1, Math.floor(originalHeight * previewWidth / originalWidth));
}
else {
previewWidth = Math.floor(originalWidth * previewHeight / originalHeight);
previewWidth = Math.max(1, Math.floor(originalWidth * previewHeight / originalHeight));
}

@@ -128,0 +128,0 @@ image = image.resize(previewWidth, previewHeight);

@@ -69,2 +69,7 @@ /// <reference types="node" />

reqResizeFile(request: FlmngrRequest): Promise<string>;
reqResizeFile2(request: FlmngrRequest): Promise<{
url: string;
width: number;
height: number;
}>;
reqGetImageOriginal(request: FlmngrRequest): {

@@ -71,0 +76,0 @@ mimeType: string;

@@ -489,2 +489,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

return __awaiter(this, void 0, void 0, function* () {
return (yield this.reqResizeFile2(request)).url;
});
}
reqResizeFile2(request) {
return __awaiter(this, void 0, void 0, function* () {
let filePath = request.getParameterString("f");

@@ -507,2 +512,9 @@ let newFileNameWithoutExt = request.getParameterString("n");

let oldExt = Utils.getExt(filePath).toLowerCase();
if (oldExt === "svg") {
return {
url: filePath,
width: -1,
height: -1
};
}
if (oldExt === "jpg" || oldExt === "jpeg") {

@@ -523,3 +535,8 @@ newExt = "jpg";

if (mode === 'DO_NOT_UPDATE' && isDstPathExists) {
return dstPath;
let info = yield this.getCachedImagePreviewAndResolution(dstPath, this.driverFiles.get(dstPath));
return {
url: dstPath,
width: info.width,
height: info.height
};
}

@@ -554,3 +571,8 @@ let contents = this.driverFiles.get(filePath);

newFileNameWithoutExt + "." + oldExt === oldFileNameWithExt) {
return filePath;
let info = yield this.getCachedImagePreviewAndResolution(filePath, this.driverFiles.get(filePath));
return {
url: filePath,
width: info.width,
height: info.height
};
}

@@ -565,11 +587,15 @@ else {

ratio = width / originalWidth;
height = Math.floor(originalHeight * ratio);
height = Math.max(1, Math.floor(originalHeight * ratio));
}
else if (needToFitHeight) {
ratio = height / originalHeight;
width = Math.floor(originalWidth * ratio);
width = Math.max(1, Math.floor(originalWidth * ratio));
}
let resizedImage = image.resize(width, height);
this.driverFiles.put(dstPath, yield resizedImage.toFormat(newExt).toBuffer());
return dstPath;
return {
url: dstPath,
width: width,
height: height
};
});

@@ -592,4 +618,4 @@ }

return {
version: "5",
build: "1",
version: "6",
build: "3",
language: "node",

@@ -596,0 +622,0 @@ framework: framework || "custom",

{
"name": "@flmngr/flmngr-server-node",
"description": "Node server-side implementation of Flmngr file manager",
"version": "1.5.1",
"version": "1.5.2",
"private": false,

@@ -11,3 +11,3 @@ "author": {

"homepage": "https://flmngr.com",
"repository": "https://github.com/edsdk/flmngr-server-node",
"repository": "https://github.com/flmngr/flmngr-server-node",
"license": "LGPL v3",

@@ -61,4 +61,4 @@ "scripts": {

},
"engines" : {
"node" : ">=14.15.0"
"engines": {
"node": ">=14.15.0"
},

@@ -65,0 +65,0 @@ "types": "./dist/cjs/index.d.ts",

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

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

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