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

@thirdweb-dev/storage

Package Overview
Dependencies
Maintainers
10
Versions
801
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thirdweb-dev/storage - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1-nightly-274afb5

dist/declarations/src/constants/urls.d.ts

2

dist/thirdweb-dev-storage.cjs.d.ts

@@ -1,1 +0,1 @@

export * from "./declarations/dist/index";
export * from "./declarations/src/index";

@@ -5,5 +5,5 @@ 'use strict';

var file = require('@web-std/file');
var FormData = require('form-data');
var fetch$1 = require('cross-fetch');
var zod = require('zod');

@@ -566,2 +566,8 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }

function isFileInstance(data) {
return global.File && data instanceof File;
}
function isBufferInstance(data) {
return global.Buffer && data instanceof Buffer;
}
/**

@@ -585,3 +591,3 @@ * Given a map of file hashes to ipfs uris, this function will hash

var val = object[keys[key]];
var isFile = val instanceof file.File || val instanceof Buffer;
var isFile = isFileInstance(val) || isBufferInstance(val);

@@ -659,3 +665,3 @@ if (_typeof(val) === "object" && !isFile) {

object[keys[key]] = val.map(function (el) {
var isFile = el instanceof file.File || el instanceof Buffer;
var isFile = isFileInstance(el) || isBufferInstance(el);

@@ -670,3 +676,3 @@ if (_typeof(el) === "object" && !isFile) {

var isFile = val instanceof file.File || val instanceof Buffer;
var isFile = isFileInstance(val) || isBufferInstance(val);

@@ -933,16 +939,16 @@ if (_typeof(val) === "object" && !isFile) {

var fileNames = [];
files.forEach(function (file$1, i) {
files.forEach(function (file, i) {
var fileName = "";
var fileData = file$1; // if it is a file, we passthrough the file extensions,
var fileData = file; // if it is a file, we passthrough the file extensions,
// if it is a buffer or string, the filename would be fileStartNumber + index
// if it is a buffer or string with names, the filename would be the name
if (file$1 instanceof file.File) {
if (isFileInstance(file)) {
var extensions = "";
if (file$1.name) {
var extensionStartIndex = file$1.name.lastIndexOf(".");
if (file.name) {
var extensionStartIndex = file.name.lastIndexOf(".");
if (extensionStartIndex > -1) {
extensions = file$1.name.substring(extensionStartIndex);
extensions = file.name.substring(extensionStartIndex);
}

@@ -952,7 +958,7 @@ }

fileName = "".concat(i + fileStartNumber).concat(extensions);
} else if (file$1 instanceof Buffer || typeof file$1 === "string") {
} else if (isBufferInstance(file) || typeof file === "string") {
fileName = "".concat(i + fileStartNumber);
} else if (file$1 && file$1.name && file$1 !== null && file$1 !== void 0 && file$1.data) {
fileData = file$1 === null || file$1 === void 0 ? void 0 : file$1.data;
fileName = "".concat(file$1.name);
} else if (file && file.name && file !== null && file !== void 0 && file.data) {
fileData = file === null || file === void 0 ? void 0 : file.data;
fileName = "".concat(file.name);
} else {

@@ -1478,3 +1484,3 @@ // default behavior

if (val instanceof file.File || val instanceof Buffer) {
if (isFileInstance(val) || isBufferInstance(val)) {
files.push(val);

@@ -1577,3 +1583,2 @@ } else if (_typeof(val) === "object") {

*/
var RemoteStorage = /*#__PURE__*/function () {

@@ -1675,3 +1680,3 @@ function RemoteStorage(storage) {

if (!(data instanceof file.File || data instanceof Buffer || data.name && data.data && data.data instanceof Buffer)) {
if (!(isFileInstance(data) || isBufferInstance(data) || data.name && data.data && isBufferInstance(data.data))) {
_context2.next = 5;

@@ -1688,6 +1693,6 @@ break;

allFiles = data.filter(function (item) {
return item instanceof file.File || item instanceof Buffer || item.name && item.data && item.data instanceof Buffer;
return isFileInstance(item) || isBufferInstance(item) || item.name && item.data && isBufferInstance(item.data);
});
allObjects = data.filter(function (item) {
return !(item instanceof file.File) && !(item instanceof Buffer);
return !isFileInstance(item) && !isBufferInstance(item);
});

@@ -1788,3 +1793,13 @@

var isBrowser = function isBrowser() {
return typeof window !== "undefined";
};
var fileOrBufferUnion = isBrowser() ? [zod.z["instanceof"](File), zod.z.string()] : [zod.z["instanceof"](Buffer), zod.z.string()];
var FileBufferOrStringSchema = zod.z.union(fileOrBufferUnion);
exports.FileBufferOrStringSchema = FileBufferOrStringSchema;
exports.IpfsStorage = IpfsStorage;
exports.RemoteStorage = RemoteStorage;
exports.isBrowser = isBrowser;
exports.isBufferInstance = isBufferInstance;
exports.isFileInstance = isFileInstance;

@@ -5,5 +5,5 @@ 'use strict';

var file = require('@web-std/file');
var FormData = require('form-data');
var fetch$1 = require('cross-fetch');
var zod = require('zod');

@@ -566,2 +566,8 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }

function isFileInstance(data) {
return global.File && data instanceof File;
}
function isBufferInstance(data) {
return global.Buffer && data instanceof Buffer;
}
/**

@@ -585,3 +591,3 @@ * Given a map of file hashes to ipfs uris, this function will hash

var val = object[keys[key]];
var isFile = val instanceof file.File || val instanceof Buffer;
var isFile = isFileInstance(val) || isBufferInstance(val);

@@ -659,3 +665,3 @@ if (_typeof(val) === "object" && !isFile) {

object[keys[key]] = val.map(function (el) {
var isFile = el instanceof file.File || el instanceof Buffer;
var isFile = isFileInstance(el) || isBufferInstance(el);

@@ -670,3 +676,3 @@ if (_typeof(el) === "object" && !isFile) {

var isFile = val instanceof file.File || val instanceof Buffer;
var isFile = isFileInstance(val) || isBufferInstance(val);

@@ -933,16 +939,16 @@ if (_typeof(val) === "object" && !isFile) {

var fileNames = [];
files.forEach(function (file$1, i) {
files.forEach(function (file, i) {
var fileName = "";
var fileData = file$1; // if it is a file, we passthrough the file extensions,
var fileData = file; // if it is a file, we passthrough the file extensions,
// if it is a buffer or string, the filename would be fileStartNumber + index
// if it is a buffer or string with names, the filename would be the name
if (file$1 instanceof file.File) {
if (isFileInstance(file)) {
var extensions = "";
if (file$1.name) {
var extensionStartIndex = file$1.name.lastIndexOf(".");
if (file.name) {
var extensionStartIndex = file.name.lastIndexOf(".");
if (extensionStartIndex > -1) {
extensions = file$1.name.substring(extensionStartIndex);
extensions = file.name.substring(extensionStartIndex);
}

@@ -952,7 +958,7 @@ }

fileName = "".concat(i + fileStartNumber).concat(extensions);
} else if (file$1 instanceof Buffer || typeof file$1 === "string") {
} else if (isBufferInstance(file) || typeof file === "string") {
fileName = "".concat(i + fileStartNumber);
} else if (file$1 && file$1.name && file$1 !== null && file$1 !== void 0 && file$1.data) {
fileData = file$1 === null || file$1 === void 0 ? void 0 : file$1.data;
fileName = "".concat(file$1.name);
} else if (file && file.name && file !== null && file !== void 0 && file.data) {
fileData = file === null || file === void 0 ? void 0 : file.data;
fileName = "".concat(file.name);
} else {

@@ -1478,3 +1484,3 @@ // default behavior

if (val instanceof file.File || val instanceof Buffer) {
if (isFileInstance(val) || isBufferInstance(val)) {
files.push(val);

@@ -1577,3 +1583,2 @@ } else if (_typeof(val) === "object") {

*/
var RemoteStorage = /*#__PURE__*/function () {

@@ -1675,3 +1680,3 @@ function RemoteStorage(storage) {

if (!(data instanceof file.File || data instanceof Buffer || data.name && data.data && data.data instanceof Buffer)) {
if (!(isFileInstance(data) || isBufferInstance(data) || data.name && data.data && isBufferInstance(data.data))) {
_context2.next = 5;

@@ -1688,6 +1693,6 @@ break;

allFiles = data.filter(function (item) {
return item instanceof file.File || item instanceof Buffer || item.name && item.data && item.data instanceof Buffer;
return isFileInstance(item) || isBufferInstance(item) || item.name && item.data && isBufferInstance(item.data);
});
allObjects = data.filter(function (item) {
return !(item instanceof file.File) && !(item instanceof Buffer);
return !isFileInstance(item) && !isBufferInstance(item);
});

@@ -1788,3 +1793,13 @@

var isBrowser = function isBrowser() {
return typeof window !== "undefined";
};
var fileOrBufferUnion = isBrowser() ? [zod.z["instanceof"](File), zod.z.string()] : [zod.z["instanceof"](Buffer), zod.z.string()];
var FileBufferOrStringSchema = zod.z.union(fileOrBufferUnion);
exports.FileBufferOrStringSchema = FileBufferOrStringSchema;
exports.IpfsStorage = IpfsStorage;
exports.RemoteStorage = RemoteStorage;
exports.isBrowser = isBrowser;
exports.isBufferInstance = isBufferInstance;
exports.isFileInstance = isFileInstance;
{
"name": "@thirdweb-dev/storage",
"version": "0.1.0",
"version": "0.1.1-nightly-274afb5",
"main": "dist/thirdweb-dev-storage.cjs.js",
"repository": "https://github.com/thirdweb-dev/storage.git",
"author": "adam-maj <mr.adam.maj@gmail.com>",
"module": "dist/thirdweb-dev-storage.esm.js",
"repository": {
"directory": "packages/storage",
"type": "git",
"url": "https://github.com/thirdweb-dev/js.git"
},
"author": "thirdweb eng <eng@thirdweb.com>",
"license": "Apache-2.0",
"scripts": {
"build": "tsc --noEmit && preconstruct build",
"build": "tsc && preconstruct build",
"test": "ts-mocha 'test/**/*.ts' --paths -t 120000 -r esm -p tsconfig.testing.json"

@@ -24,3 +29,2 @@ },

"@preconstruct/cli": "^2.2.1",
"@trivago/prettier-plugin-sort-imports": "^3.3.0",
"@types/chai": "^4.3.3",

@@ -32,10 +36,4 @@ "@types/mocha": "^9.1.1",

"eslint": "^8.22.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-inclusive-language": "^2.2.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-tsdoc": "^0.2.16",
"esm": "^3.2.25",
"mocha": "^10.0.0",
"prettier": "^2.7.1",
"ts-mocha": "^10.0.0",

@@ -46,6 +44,6 @@ "tsc": "^2.0.4",

"dependencies": {
"@web-std/file": "^3.0.2",
"cross-fetch": "^3.1.5",
"form-data": "^4.0.0"
"form-data": "^4.0.0",
"zod": "^3.18.0"
}
}
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