Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
divshot-upload
Advanced tools
Upload app files to Divshot
npm install divshot-upload --save
bower install divshot-upload --save
var fs = require('fs');
var upload = require('divshot-upload');
var fileStream = fs.creatReadStream('some-file.tar');
var uploadOptions = {
token: 'user-token',
environment: 'production',
type: 'tar',
config: {
name: 'uploadapp',
root: './'
},
files: {}
};
fileStream
.pipe(upload(uploadOptions))
.on('message', function (msg) {})
.on('released', function (filepath) {})
.on('releasing', function () {})
.on('pushed', function () {})
.on('unreleased', function (unreleasedFiles) {})
.on('error', function (err) {});
<script src="/bower_components/divshot-upload/dist/upload.directive.js"></script>
angular.modules('myApp', ['divshot.upload']);
HTML
The <ds-upload/>
element becomes a drag and drop zone OR you can click on it to upload a file
<div ng-controller="AppController">
<ds-upload class="divshot-upload"
ds-config="appConfig"
ds-environment="environment"
ds-token="token"
ds-enter="onEnter()"
ds-leave="onLeave()"
ds-drop="onDrop()"
ds-progress="onProgress(type, message)"
ds-done="onDone()"
ds-start="onStart()"
ds-unreleased="onUnreleased(files)"
ds-error="onError(message)"
ds-host="host">
Drop Here or Click Here to Upload File
</ds-upload>
</div>
Controller
angular.modules('myApp')
.controller('AppController', function ($scope) {
$scope.environment = 'production';
$scope.token = 'some-user-token';
$scope.host = 'http://dev.host'; // OPTIONAL
$scope.appConfig = {
name: 'uploadapp',
clean_urls: true
};
$scope.onEnter = function () {
console.log('enter');
};
$scope.onLeave = function () {
console.log('leave');
};
$scope.onDrop = function () {
console.log('drop');
};
$scope.onProgress = function (type, message) {
console.log(type + ':', message);
};
$scope.onDone = function () {
console.log('Application deployed!');
};
$scope.onStart = function () {
console.log('Upload started');
};
$scope.onUnreleased = function (files) {
console.error('Not all files released.');
Object.keys(files).forEach(function (filename) {
console.error(filename + ' unreleased');
});
};
$scope.onError = function (message) {
console.error('ERROR:', message);
};
});
token
- user authentication tokenenvironment
- environment to push totype
- type of file to upload (tar or zip only for now)config
- application configuration (taken from the divshot.json file)host
- OPTIONAL - the divshot api endpoint (Used for dev, test, and production environments). Defaults to production api.files
- OPTIONAL. an object of files where the key of each item is the relative path to the file and the value is an empty object. This is used to track unreleased files.The upload stream emits the following events
message
- generic message from upload stream
function (message) {}
releasing
- started the releasing stage of the push
function () {}
released
- individual file has been released
function (file) {}
pushed
- build has been fully pushed and deployed
function () {}
unreleased
- only fired if there were unreleased files
function (unreleasedFiles) {}
error
- an error occured in the process
function (err) {}
Runs server side tests and browser tests. Browser tests require that Phantomjs is installed
npm install
npm test
FAQs
Upload app files to Divshot
The npm package divshot-upload receives a total of 0 weekly downloads. As such, divshot-upload popularity was classified as not popular.
We found that divshot-upload demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.