Socket
Socket
Sign inDemoInstall

@platform/fs.s3

Package Overview
Dependencies
128
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.64 to 0.7.67

lib/common/util.TEST.js

2

lib/common/util.format.js

@@ -10,3 +10,3 @@ "use strict";

function formatETag(value) {
return value ? value.replace(/^\"/, '').replace(/\"$/, '') : '';
return value ? value.replace(/^"/, '').replace(/"$/, '') : '';
}

@@ -13,0 +13,0 @@ exports.formatETag = formatETag;

@@ -9,8 +9,8 @@ "use strict";

function toBucketUrl(args) {
var bucket = util_format_1.formatBucket(args.bucket);
var bucket = (0, util_format_1.formatBucket)(args.bucket);
if (!bucket) {
throw new Error("No bucket provided.");
}
var url = url_1.parse(args.s3.endpoint.href, false);
return "https://" + bucket + "." + url.host;
var url = (0, url_1.parse)(args.s3.endpoint.href, false);
return "https://".concat(bucket, ".").concat(url.host);
}

@@ -21,4 +21,4 @@ exports.toBucketUrl = toBucketUrl;

var endpoint = toBucketUrl({ s3: s3, bucket: bucket });
var path = util_format_1.formatKeyPath(args.path);
return endpoint + "/" + path;
var path = (0, util_format_1.formatKeyPath)(args.path);
return "".concat(endpoint, "/").concat(path);
}

@@ -28,3 +28,3 @@ exports.toObjectUrl = toObjectUrl;

var s3 = args.s3, bucket = args.bucket;
var path = util_format_1.formatKeyPath(args.path);
var path = (0, util_format_1.formatKeyPath)(args.path);
if (!path) {

@@ -37,3 +37,3 @@ throw new Error("Object key path must be specified for pre-signed URLs.");

Key: path,
Expires: util_time_1.toSeconds(expires),
Expires: (0, util_time_1.toSeconds)(expires),
};

@@ -50,7 +50,7 @@ if (operation === 'putObject') {

var s3 = args.s3, expires = args.expires, acl = args.acl, bucket = args.bucket;
var key = util_format_1.formatKeyPath(args.key);
var key = (0, util_format_1.formatKeyPath)(args.key);
if (!key) {
throw new Error("Object key path must be specified for pre-signed URLs.");
}
var contentType = args.contentType || libs_1.toMimetype(key, 'application/octet-stream');
var contentType = args.contentType || (0, libs_1.toMimetype)(key, 'application/octet-stream');
var fields = {

@@ -68,3 +68,3 @@ 'content-type': contentType,

var post = s3.createPresignedPost({
Expires: util_time_1.toSeconds(expires),
Expires: (0, util_time_1.toSeconds)(expires),
Bucket: bucket,

@@ -71,0 +71,0 @@ Conditions: Conditions,

/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import { S3, S3Config } from './types';

@@ -39,9 +41,9 @@ export * from './types';

lstat: typeof import("fs-extra").lstat;
lstatSync: import("fs").StatSyncFn<import("fs").PathLike>;
lstatSync: import("fs").StatSyncFn;
path: import("path").PlatformPath;
join: (...paths: string[]) => string;
resolve: (...pathSegments: string[]) => string;
dirname: (p: string) => string;
basename: (p: string, ext?: string | undefined) => string;
extname: (p: string) => string;
resolve: (...paths: string[]) => string;
dirname: (path: string) => string;
basename: (path: string, ext?: string | undefined) => string;
extname: (path: string) => string;
size: {

@@ -48,0 +50,0 @@ toString(input: number | Buffer, options?: import("@platform/fs/lib/size").IFileSizeStringOptions | undefined): string;

@@ -27,3 +27,3 @@ "use strict";

Key: target.key,
CopySource: encodeURI(source.bucket + "/" + source.key),
CopySource: encodeURI("".concat(source.bucket, "/").concat(source.key)),
ACL: args.acl,

@@ -36,3 +36,3 @@ ContentType: args.contentType,

res = _b.sent();
etag = common_1.formatETag((_a = res.CopyObjectResult) === null || _a === void 0 ? void 0 : _a.ETag);
etag = (0, common_1.formatETag)((_a = res.CopyObjectResult) === null || _a === void 0 ? void 0 : _a.ETag);
return [2, done(200, { etag: etag })];

@@ -39,0 +39,0 @@ case 3:

@@ -35,3 +35,3 @@ "use strict";

catch (error) {
throw new Error("Failed to parse S3 object at key [" + key + "] from JSON. " + error.message);
throw new Error("Failed to parse S3 object at key [".concat(key, "] from JSON. ").concat(error.message));
}

@@ -43,6 +43,6 @@ }

readProps = function (obj) {
response.modifiedAt = common_1.formatTimestamp(obj.LastModified);
response.etag = common_1.formatETag(obj.ETag);
response.modifiedAt = (0, common_1.formatTimestamp)(obj.LastModified);
response.etag = (0, common_1.formatETag)(obj.ETag);
response.contentType = obj.ContentType || '';
response.bytes = common_1.defaultValue(obj.ContentLength, -1);
response.bytes = (0, common_1.defaultValue)(obj.ContentLength, -1);
return obj;

@@ -49,0 +49,0 @@ };

@@ -35,31 +35,31 @@ "use strict";

var endpoint = options.endpoint;
return s3_url_1.url({ getS3: getS3, bucket: bucket, path: path, endpoint: endpoint });
return (0, s3_url_1.url)({ getS3: getS3, bucket: bucket, path: path, endpoint: endpoint });
},
list: function (args) {
var s3 = getS3('origin');
return s3_list_1.list(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
return (0, s3_list_1.list)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
},
get: function (args) {
var s3 = getS3('origin');
return s3_get_1.get(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
return (0, s3_get_1.get)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
},
put: function (args) {
var s3 = getS3('origin');
return s3_put_1.put(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
return (0, s3_put_1.put)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
},
post: function (args) {
var s3 = getS3('origin');
return s3_post_1.post(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
return (0, s3_post_1.post)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
},
deleteOne: function (args) {
var s3 = getS3('origin');
return s3_delete_1.deleteOne(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
return (0, s3_delete_1.deleteOne)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
},
deleteMany: function (args) {
var s3 = getS3('origin');
return s3_delete_1.deleteMany(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
return (0, s3_delete_1.deleteMany)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
},
copy: function (args) {
var s3 = getS3('origin');
return s3_copy_1.copy(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
return (0, s3_copy_1.copy)(tslib_1.__assign(tslib_1.__assign({}, args), { s3: s3 }));
},

@@ -66,0 +66,0 @@ bucket: function (name) {

@@ -28,3 +28,3 @@ "use strict";

prefix: prefix || '',
max: common_1.defaultValue(max, -1),
max: (0, common_1.defaultValue)(max, -1),
items: [],

@@ -36,4 +36,4 @@ };

key: data.Key || '',
modifiedAt: common_1.formatTimestamp(data.LastModified),
etag: common_1.formatETag(data.ETag) || '',
modifiedAt: (0, common_1.formatTimestamp)(data.LastModified),
etag: (0, common_1.formatETag)(data.ETag) || '',
storage: data.StorageClass || 'STANDARD',

@@ -88,3 +88,3 @@ owner: {

prefix: prefix || '',
max: common_1.defaultValue(max, -1),
max: (0, common_1.defaultValue)(max, -1),
items: [],

@@ -99,3 +99,3 @@ };

_a.trys.push([1, 4, , 5]);
Prefix = args.prefix ? args.prefix.replace(/\/$/, '') + "/" : undefined;
Prefix = args.prefix ? "".concat(args.prefix.replace(/\/$/, ''), "/") : undefined;
return [4, s3.listObjectsV2({

@@ -102,0 +102,0 @@ Bucket: bucket,

@@ -59,3 +59,3 @@ "use strict";

if (err) {
var error = new Error(("Failed getting object meta-data. " + err.message).trim());
var error = new Error("Failed getting object meta-data. ".concat(err.message).trim());
done(500, { error: error });

@@ -71,3 +71,3 @@ }

else {
error = new Error(("Failed to post object. " + res.statusText).trim());
error = new Error("Failed to post object. ".concat(res.statusText).trim());
done(status, { error: error });

@@ -74,0 +74,0 @@ }

@@ -14,3 +14,3 @@ "use strict";

url = common_1.util.toObjectUrl({ s3: s3, bucket: bucket, path: key });
contentType = args.contentType || common_1.toMimetype(key, 'application/octet-stream');
contentType = args.contentType || (0, common_1.toMimetype)(key, 'application/octet-stream');
done = function (status, options) {

@@ -17,0 +17,0 @@ if (options === void 0) { options = {}; }

{
"name": "@platform/fs.s3",
"version": "0.7.64",
"version": "0.7.67",
"description": "Filesystem like API into AWS S3 (and Digital Ocean Spaces)",

@@ -9,3 +9,2 @@ "main": "lib/index",

"test": "ts test",
"tdd": "ts test --watch",
"lint": "ts lint",

@@ -18,18 +17,18 @@ "build": "ts build --no-esm",

"dependencies": {
"@platform/fs": "0.7.5",
"@platform/fs.s3.types": "0.3.27",
"@platform/http": "0.14.29",
"@platform/libs": "0.2.14",
"@platform/log": "0.1.62",
"@platform/types": "0.5.25",
"@platform/util.mimetype": "0.1.48",
"@platform/util.value": "0.9.10",
"aws-sdk": "2.979.0",
"@platform/fs": "0.7.9",
"@platform/fs.s3.types": "0.3.30",
"@platform/http": "0.14.32",
"@platform/libs": "0.3.2",
"@platform/log": "0.1.65",
"@platform/types": "0.5.27",
"@platform/util.mimetype": "0.1.51",
"@platform/util.value": "0.9.13",
"aws-sdk": "2.1186.0",
"form-data": "4.0.0"
},
"devDependencies": {
"@platform/test": "0.2.10",
"@platform/ts": "4.1.23",
"@platform/test": "0.3.2",
"@platform/ts": "4.7.7",
"@types/dotenv": "8.2.0",
"dotenv": "10.0.0"
"dotenv": "16.0.1"
},

@@ -36,0 +35,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc