New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sftp-promises

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sftp-promises - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

tmp/test.zip

21

index.js
var Client = require('ssh2').Client;
var MODES = require('ssh2').SFTP_OPEN_MODE;
// var Promise = require('bluebird');

@@ -73,10 +74,15 @@

if (err) { reject(err); conn.end(); return false }
var buffer = Buffer(stat.size);
var bytes = stat.size;
var buffer = Buffer(bytes);
buffer.fill(0);
sftp.read(handle, buffer, 0, buffer.length, 0, function (err) {
if (err) {
var cb = function(err, readBytes, offsetBuffer, position) {
if(err) {
reject(err);
sftp.close();
conn.end();
return false;
} else {
}
position = position + readBytes;
bytes = bytes - readBytes;
if (bytes < 1) {
sftp.close(handle, function (err) {

@@ -89,7 +95,10 @@ conn.end();

resolve(buffer);
return buffer;
return;
}
})
} else {
sftp.read(handle, buffer, position, bytes, position, cb)
}
})
}
sftp.read(handle, buffer, 0, bytes, 0, cb)
})

@@ -96,0 +105,0 @@ })

{
"name": "sftp-promises",
"version": "1.0.1",
"version": "1.0.2",
"description": "SFTP Promise wrapper for ssh2 SFTP commands",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -32,2 +32,3 @@ var fs = require('fs');

it('tranfer buffer to file', function *() {
//this.timeout(0) // enable for testing with large files
var val = yield sftp.putBuffer(buffer, '/tmp/test.dat');

@@ -37,2 +38,3 @@ val.should.be.true;

it('tranfer file to buffer', function *() {
//this.timeout(0) // enable for testing with large files
var rbuffer = yield sftp.getBuffer('/tmp/test.dat');

@@ -45,2 +47,3 @@ rbuffer.equals(buffer).should.be.true;

it('should transfer local file to remote', function *() {
this.timeout(0)
var val = yield sftp.put('test/test.dat', '/tmp/test.dat');

@@ -50,2 +53,3 @@ val.should.be.true;

it('should transfer remote file locally', function *(){
this.timeout(0)
var val = yield sftp.get('/tmp/test.dat', '/tmp/transfertest.remove');

@@ -52,0 +56,0 @@ val.should.be.true;

Sorry, the diff of this file is not supported yet

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