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

dynamodb-localhost

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamodb-localhost - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

test/index.test.js

16

dynamodb/config.json
{
"setup": {
"download_url": "http://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz",
"install_path": "./bin",
"jar": "DynamoDBLocal.jar"
},
"start": {
"port": 8000
}
"setup": {
"download_url": "http://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz",
"install_path": "bin",
"jar": "DynamoDBLocal.jar"
},
"start": {
"port": 8000
}
}

@@ -1,62 +0,75 @@

'use strict';
"use strict";
var tar = require('tar'),
zlib = require('zlib'),
path = require('path'),
http = require('http'),
fs = require('fs'),
ProgressBar = require('progress'),
utils = require('./utils');
var tar = require("tar"),
zlib = require("zlib"),
path = require("path"),
http = require("http"),
fs = require("fs"),
ProgressBar = require("progress"),
utils = require("./utils");
var download = function (downloadUrl, installPath, callback) {
console.log("Started downloading Dynamodb-local. Process may take few minutes.");
http.get(downloadUrl, function (response) {
var len = parseInt(response.headers['content-length'], 10),
bar = new ProgressBar('Downloading dynamodb-local [:bar] :percent :etas', {
complete: '=',
incomplete: ' ',
width: 40,
total: len
});
var download = function(downloadUrl, installPath, callback) {
console.log(
`Started downloading dynamodb-local from ${downloadUrl} into ${installPath}. Process may take few minutes.`
);
http
.get(downloadUrl, function(response) {
var len = parseInt(response.headers["content-length"], 10),
bar = new ProgressBar(
"Downloading dynamodb-local [:bar] :percent :etas",
{
complete: "=",
incomplete: " ",
width: 40,
total: len
}
);
if (200 != response.statusCode) {
throw new Error('Error getting DynamoDb local latest tar.gz location ' + response.headers.location + ': ' + response.statusCode);
}
if (200 != response.statusCode) {
throw new Error(
"Error getting DynamoDb local latest tar.gz location " +
response.headers.location +
": " +
response.statusCode
);
}
response
.pipe(zlib.Unzip())
.pipe(tar.Extract({
path: installPath
}))
.on('data', function (chunk) {
bar.tick(chunk.length);
})
.on('end', function () {
callback("\n Installation complete!");
})
.on('error', function (err) {
throw new Error("Error in downloading Dynamodb local " + err);
});
})
.on('error', function (err) {
throw new Error("Error in downloading Dynamodb local " + err);
response
.pipe(zlib.Unzip())
.pipe(
tar.x({
C: installPath
})
)
.on("data", function(chunk) {
bar.tick(chunk.length);
})
.on("end", function() {
callback("\n Installation complete!");
})
.on("error", function(err) {
throw new Error("Error in downloading Dynamodb local " + err);
});
})
.on("error", function(err) {
throw new Error("Error in downloading Dynamodb local " + err);
});
};
var install = function (config, callback) {
var install_path = utils.absPath(config.setup.install_path),
jar = config.setup.jar,
download_url = config.setup.download_url;
var install = function(config, callback) {
var install_path = utils.absPath(config.setup.install_path),
jar = config.setup.jar,
download_url = config.setup.download_url;
try {
if (fs.existsSync(path.join(install_path, jar))) {
callback("Dynamodb is already installed on path!");
} else {
utils.createDir(config.setup.install_path);
download(download_url, install_path, callback);
}
} catch (err) {
throw new Error("Error configuring or installing Dynamodb local " + err);
try {
if (fs.existsSync(path.join(install_path, jar))) {
callback("Dynamodb is already installed on path!");
} else {
utils.createDir(config.setup.install_path);
download(download_url, install_path, callback);
}
} catch (err) {
throw new Error("Error configuring or installing Dynamodb local " + err);
}
};
module.exports.install = install;
{
"name": "dynamodb-localhost",
"version": "0.0.8",
"version": "0.0.9",
"engines": {

@@ -28,5 +28,9 @@ "node": ">=4.0"

"main": "index.js",
"bin": {},
"scripts": {
"test": "mocha test/*.test.js --reporter spec"
},
"dependencies": {
"chai": "^4.2.0",
"mkdirp": "^0.5.0",
"mocha": "^6.1.4",
"progress": "^1.1.8",

@@ -33,0 +37,0 @@ "rimraf": "^2.6.3",

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