Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var fs = require('fs');
var AWS = require('aws-sdk');
var bindings = require('bindings');
var index = require('../lib');
var log = index.log;
var config = require(process.env.HOME + '/.bitcore-node-upload.json');
AWS.config.region = config.region;
AWS.config.update({
accessKeyId: config.accessKeyId,
secretAccessKey: config.secretAccessKey
});
var packageRoot = bindings.getRoot(bindings.getFileName());
var tarballName = require('./get-tarball-name')();
var bucketName = 'bitcore-node';
var url = 'https://' + bucketName + '.s3.amazonaws.com/' + tarballName;
var localPath = packageRoot + '/' + tarballName;
log.info('Uploading package: ' + localPath);
var fileStream = fs.createReadStream(localPath);
fileStream.on('error', function(err) {
if (err) {
throw err;
}
});
fileStream.on('open', function() {
'use strict';
var exec = require('child_process').exec;
var bindings = require('bindings');
var index = require('../lib');
var log = index.log;
var packageRoot = bindings.getRoot(bindings.getFileName());
var binaryPath = bindings({
path: true,
bindings: 'bitcoind.node'
});
var relativeBinaryPath = binaryPath.replace(packageRoot + '/', '');
var tarballName = require('./get-tarball-name')();
log.info('Signing binding binary: "' + binaryPath + '"');
var signCommand = 'gpg --yes --out ' + binaryPath + '.sig --detach-sig ' + binaryPath;
var signchild = exec(signCommand, function(error, stdout, stderr) {
if (error) {
throw error;
}