Gathering detailed insights and metrics for jsftp-checksum
Gathering detailed insights and metrics for jsftp-checksum
Gathering detailed insights and metrics for jsftp-checksum
Gathering detailed insights and metrics for jsftp-checksum
jsftp
A sane FTP client implementation for NodeJS
@types/jsftp
TypeScript definitions for jsftp
crc32-stream
a streaming CRC32 checksumer
@smithy/middleware-apply-body-checksum
[![NPM version](https://img.shields.io/npm/v/@smithy/middleware-apply-body-checksum/latest.svg)](https://www.npmjs.com/package/@smithy/middleware-apply-body-checksum) [![NPM downloads](https://img.shields.io/npm/dm/@smithy/middleware-apply-body-checksum.s
npm install jsftp-checksum
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
28 Commits
2 Watching
1 Branches
1 Contributors
Updated on 19 Dec 2017
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
100%
4
Compared to previous week
Last month
233.3%
10
Compared to previous month
Last year
-29.9%
155
Compared to previous year
Adds support for some ftp server checksum commands to JSFtp
Some FTP servers provide commands that allow the client to retrieve a checksum for a file on the server. This can make operations like sync-ing much faster and more reliable since you don't need to rely on attributes like the file size and modified time to determine if the file has changed. Plus, the size reported by several ftp server commands can just be approximations, and the modified time can change even if the contents of the file have not changed so those methods can be error-prone.
This module adds methods to JSFtp to access some of those checksum commands and parse the results. Currently supported checksum commands: MD5, XMD5, XCRC, XSHA, XSHA1, XSHA256, XSHA512.
References:
List of Non-standard Cryptographic Hash...
Be sure to check that the Ftp server supports the desired checksum algorithm before trying to use it.
The checksums supported here are non-standard so ymmv. Feel free to report an issue if one of the included checksum algorithms doesn't work as expected with your ftp server. Be sure to verify that the server supports that algorithm first. If you do open an issue, please include the full server response.
All checksums are returned as hex-encoded strings with the A-F
converted to upper case.
1const jsftp = require("jsftp"); 2require('jsftp-checksum')(jsftp); 3 4var Ftp = new jsftp({ 5 host: "myserver.com", 6 port: 3331, // defaults to 21 7 user: "user", // defaults to "anonymous" 8 pass: "1234" // defaults to "@anonymous" 9}); 10 11Ftp.on("connect", () => { 12 // we need to explicitly call getFeatures in this example since xmd5 13 // would be the first command to be executed after connecting 14 Ftp.getFeatures(err => { 15 if (err) { 16 console.log(err); 17 } else { 18 if (Ftp.hasFeat("xmd5")) { // command "xmd5" case doesn't matter here 19 Ftp.xmd5("myfile.txt", (err, checksum) => { 20 if (err) { 21 console.log(err); 22 } else { 23 console.log(checksum); 24 // Prints something like 25 // 7F1EE68D2344001A050752B669242182 26 } 27 }); 28 } 29 } 30 }); 31 32 // Ftp.destroy() when you're finished 33});
With the md5
method you can retrieve the MD5 checksum for a file on the server
that accepts the MD5 command. The method accepts a callback with the signature err, checksum
, in which err
is the error
response coming from the server (usually a 4xx or 5xx error code), or an error
indicating the MD5 response couldn't be parsed, and checksum
is a string containing the checksum.
Known server support seems to be based on: FTP MD5 Draft Spec - Expired
1 2Ftp.md5('myfile.txt', (err, checksum) => { 3 if (err) { 4 console.log(err); 5 } else { 6 console.log(checksum); 7 // Prints something like 8 // 7F1EE68D2344001A050752B669242182 9 } 10});
With the xmd5
method you can retrieve the MD5 checksum for a file on the server
that accepts the XMD5 command. The method accepts a callback with the signature err, checksum
, in which err
is the error
response coming from the server (usually a 4xx or 5xx error code), or an error
indicating the XMD5 response couldn't be parsed, and checksum
is a string containing the checksum.
1 2Ftp.xmd5('myfile.txt', (err, checksum) => { 3 if (err) { 4 console.log(err); 5 } else { 6 console.log(checksum); 7 // Prints something like 8 // 7F1EE68D2344001A050752B669242182 9 } 10});
With the xcrc
method you can retrieve the CRC checksum for a file on the server
that accepts the XCRC command. The method accepts a callback with the signature err, checksum
, in which err
is the error
response coming from the server (usually a 4xx or 5xx error code), or an error
indicating the XCRC response couldn't be parsed, and checksum
is a string containing the checksum.
1 2Ftp.xcrc('myfile.txt', (err, checksum) => { 3 if (err) { 4 console.log(err); 5 } else { 6 console.log(checksum); 7 // Prints something like 8 // B0A3981C 9 } 10});
With the xsha
method you can retrieve the SHA1 checksum for a file on the server
that accepts the XSHA command. The method accepts a callback with the signature err, checksum
, in which err
is the error
response coming from the server (usually a 4xx or 5xx error code), or an error
indicating the XSHA response couldn't be parsed, and checksum
is a string containing the checksum.
1 2Ftp.xsha('myfile.txt', (err, checksum) => { 3 if (err) { 4 console.log(err); 5 } else { 6 console.log(checksum); 7 // Prints something like 8 // 85C7C35F151659B612C67ED74C4760A78D89F4C8 9 } 10});
With the xsha1
method you can retrieve the SHA1 checksum for a file on the server
that accepts the XSHA1 command. The method accepts a callback with the signature err, checksum
, in which err
is the error
response coming from the server (usually a 4xx or 5xx error code), or an error
indicating the XSHA1 response couldn't be parsed, and checksum
is a string containing the checksum.
1 2Ftp.xsha1('myfile.txt', (err, checksum) => { 3 if (err) { 4 console.log(err); 5 } else { 6 console.log(checksum); 7 // Prints something like 8 // 85C7C35F151659B612C67ED74C4760A78D89F4C8 9 } 10});
With the xsha256
method you can retrieve the SHA256 checksum for a file on the server
that accepts the XSHA256 command. The method accepts a callback with the signature err, checksum
, in which err
is the error
response coming from the server (usually a 4xx or 5xx error code), or an error
indicating the XSHA256 response couldn't be parsed, and checksum
is a string containing the checksum.
1 2Ftp.xsha256('myfile.txt', (err, checksum) => { 3 if (err) { 4 console.log(err); 5 } else { 6 console.log(checksum); 7 // Prints something like 8 // 06FB0EF81B1DC52CB18E1884211F18E1E2423A5B7B00978BD4DF4D97DCB9FF3C 9 } 10});
With the xsha512
method you can retrieve the SHA512 checksum for a file on the server
that accepts the XSHA512 command. The method accepts a callback with the signature err, checksum
, in which err
is the error
response coming from the server (usually a 4xx or 5xx error code), or an error
indicating the XSHA512 response couldn't be parsed, and checksum
is a string containing the checksum.
1 2Ftp.xsha512('myfile.txt', (err, checksum) => { 3 if (err) { 4 console.log(err); 5 } else { 6 console.log(checksum); 7 // Prints something like 8 // 44C4541AB7A3E73F29BAEBE5EE80B522D67204EA7BABEB7E7DC243FF87A363FC2F352A9AFC8ECAAB8F364DBDFB58B42E22AAC744CD8226A61FE01C801EAC385B 9 } 10});
Server** | MD5 | XMD5 | XCRC | XSHA | XSHA1 | XSHA256 | XSHA512 |
---|---|---|---|---|---|---|---|
ProFtp+mod_digest | Y | Y | Y | Y | Y | Y | Y |
JScape MFT | - | Y | Y | - | - | - | - |
Serv-U FTP | - | Y | Y | - | Y | Y | Y |
Key | |
---|---|
Y | jsftp-checksum has been successfully tested against this server |
N | The tested ftp server advertises algorithm support, but jsftp-checksum cannot parse it correctly |
- | The tested ftp server (as configured) does not support the algorithm |
* Other Ftp servers may be supported, please report success/failure
** Ftp server support may vary due to version/configuration differences
There are other checksum commands in the wild (and in this list). If you need support for a different one, please open an issue and I'll see if I can add it. Or, add it yourself and submit a pull request :)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More