🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@isoftdata/file-service

Package Overview
Dependencies
Maintainers
12
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isoftdata/file-service - npm Package Compare versions

Comparing version
7.0.0
to
7.0.1-beta.0
+2
-2
dist/client/FileServiceClient.d.ts

@@ -19,4 +19,4 @@ import { UploadResult } from '../app/types.js';

addFile: (opts: FileOpts) => string;
upload: () => Promise<UploadResult[]>;
filesToBeUploaded: FileOpts[];
upload: () => Promise<Array<UploadResult>>;
filesToBeUploaded: Array<FileOpts>;
}
import FormData from 'form-data';
import axios from 'axios';
import { Readable } from 'stream';
import { randomUUID } from 'crypto';
import { pipeline, withHttpError, withJsonResponse } from 'fetch-extras';
const fetchWithExtras = pipeline(fetch, withHttpError(), withJsonResponse());
export class FileServiceClient {

@@ -26,9 +27,8 @@ constructor(opts) {

});
const config = {
method: 'post',
url: `${this.url}/upload`,
return fetchWithExtras(`${this.url}/upload`, {
method: 'POST',
headers: data.getHeaders(),
data,
};
return (await axios.request(config)).data;
body: Readable.toWeb(data), //idk why Readable.toWeb is ReadableStream<any> instead of ReadableStream<Uint8Array>, but it is, so we have to cast it to the correct type
duplex: 'half', // This must be passed when the body is a ReadableStream. `duplex` isn't in the types yet, so we have to cast the options to `RequestInit` to avoid a type error. Docs for duplex: https://developer.mozilla.org/en-US/docs/Web/API/RequestInit#duplex
});
};

@@ -35,0 +35,0 @@ this.filesToBeUploaded = [];

{
"name": "@isoftdata/file-service",
"version": "7.0.0",
"version": "7.0.1-beta.0",
"description": "A generic files service for any ISoft platform.",

@@ -40,6 +40,6 @@ "type": "module",

"dependencies": {
"axios": "^1.13.2",
"debug": "^4.4.3",
"express": "^4.22.1",
"express-fileupload": "^1.5.2",
"fetch-extras": "^3.0.0",
"form-data": "^4.0.5",

@@ -46,0 +46,0 @@ "md5": "^2.3.0",

@@ -174,3 +174,3 @@ # Project Background

Supports/requires/uses Node 20 and therefore Ubuntu 20 or higher on the host OS.
Supports/requires/uses Node 20 in Docker builds and therefore requires Ubuntu 20 or higher on the host OS.

@@ -177,0 +177,0 @@ ## Version 7