Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(REST): add support for REST command
Allows the client to resume a transfer at the specified bytes
- Loading branch information
Showing
7 changed files
with
34 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const _ = require('lodash'); | ||
|
||
module.exports = { | ||
directive: 'REST', | ||
handler: function ({command} = {}) { | ||
const arg = _.get(command, 'arg'); | ||
const byteCount = parseInt(arg, 10); | ||
|
||
if (isNaN(byteCount) || byteCount < 0) return this.reply(501, 'Byte count must be 0 or greater'); | ||
|
||
this.restByteCount = byteCount; | ||
return this.reply(350, `Resarting next transfer at ${byteCount}`); | ||
}, | ||
syntax: '{{cmd}} <byte-count>', | ||
description: 'Restart transfer from the specified point. Resets after any STORE or RETRIEVE' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters