Skip to content

Commit

Permalink
feat: add context arg to url handler methods
Browse files Browse the repository at this point in the history
  • Loading branch information
arlac77 committed Jul 29, 2017
1 parent 9effe08 commit 846b602
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sftp-scheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ export default class SFTPScheme extends URLScheme {

/**
* Creates a readable stream for the content of th file associated to a given file URL
* @param context {Context} execution context
* @param url {URL} of the a file
* @param [options] {object|string} passed as options to fs.createReadStream()
* @returns {Promise}
* @fulfil {ReadableStream} - of the file content
*/
async get(url, options) {
async get(context, url, options) {
const sftp = new Client();

const co = {
Expand Down
2 changes: 2 additions & 0 deletions tests/sftp-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ test.before('start SFTP server', async t => {
});

test('get', async t => {
const context = undefined;
const scheme = new SFTPScheme({
privateKey: fs.readFileSync(
path.join(__dirname, '..', 'tests', 'fixtures', 'identity.key')
)
});
const content = await scheme.get(
context,
new URL(`sftp://${USER}:${PASSWORD}@localhost:${PORT}${FILE}`)
);

Expand Down

0 comments on commit 846b602

Please sign in to comment.