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

alphatech

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alphatech - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.eslintrc.json

61

index.js

@@ -1,57 +0,8 @@

const fs = require("fs");
const got = require("got");
const FormData = require("form-data");
const package = require("./package.json");
const { setConfig, getConfig } = require('./src/config');
const { upload } = require('./src/upload');
const alphatech = {};
alphatech.configure = function (config = {}) {
alphatech.config = {
...config,
domain: `https://api.alpha.tech`,
};
module.exports = {
setConfig,
getConfig,
upload,
};
8;
alphatech.drive = { files: {} };
alphatech.drive.files.upload = async function (file, options = {}) {
try {
if (!alphatech.config) {
throw new Error("[alphatech] Not configured");
}
if (!file) {
throw new Error("[alphatech] `file` is missing");
}
const form = new FormData();
if (typeof file === "string") {
form.append("file", fs.createReadStream(file));
} else {
form.append("file", file);
}
for (const [key, value] of Object.entries(options)) {
if (value instanceof Object) {
form.append(key, JSON.stringify(value));
} else {
form.append(key, value);
}
}
const response = await got
.post(`${alphatech.config.domain}/drive/files/upload`, {
body: form,
headers: {
"x-alphatech-javascript-version": package.version,
authorization: `Bearer ${alphatech.config.token}.${alphatech.config.teamId}`,
},
})
.json();
return response;
} catch (err) {
throw err;
}
};
module.exports = alphatech;
{
"name": "alphatech",
"version": "0.0.1",
"version": "0.0.2",
"description": "",

@@ -20,5 +20,16 @@ "main": "index.js",

"dependencies": {
"file-type": "^14.3.0",
"form-data": "^3.0.0",
"got": "^11.1.2"
"got": "^11.1.2",
"image-size": "^0.8.3",
"mime": "^2.4.5"
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-prettier": "^3.1.3",
"prettier": "^2.0.5"
}
}
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