My promise is not working properly when trying to stream a ftp file
up vote
0
down vote
favorite
So, I've been working on something and I need to stream a file from ftp to gcloud storage and it isn't working. I'm using sftp-promises and iconv to do the transactions, as I'll be listing bellow:
let sftp = new SFTPClient(myData);
let stream = iconv.decodeStream('utf16le');
sftp.getStream('file', stream)
.then(() => {
stream.pipe(iconv.encodeStream('utf8'))
.pipe(bucket.file('file.csv').createWriteStream({resumable: false}));
res.end(`Result: ${result}`);
})
.catch(err => {
res.end(err);
});
Is there something wrong? Because I don't know what to do to resolve this, I would appreciate if you guys helped me.
javascript node.js ftp sftp
New contributor
add a comment |
up vote
0
down vote
favorite
So, I've been working on something and I need to stream a file from ftp to gcloud storage and it isn't working. I'm using sftp-promises and iconv to do the transactions, as I'll be listing bellow:
let sftp = new SFTPClient(myData);
let stream = iconv.decodeStream('utf16le');
sftp.getStream('file', stream)
.then(() => {
stream.pipe(iconv.encodeStream('utf8'))
.pipe(bucket.file('file.csv').createWriteStream({resumable: false}));
res.end(`Result: ${result}`);
})
.catch(err => {
res.end(err);
});
Is there something wrong? Because I don't know what to do to resolve this, I would appreciate if you guys helped me.
javascript node.js ftp sftp
New contributor
What isres
?
– tkausl
2 days ago
2
Put the whole code, so we can give a correct answer, but you have to wrap the stream listeners on a promise and resolve it.
– Marcos Casagrande
2 days ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
So, I've been working on something and I need to stream a file from ftp to gcloud storage and it isn't working. I'm using sftp-promises and iconv to do the transactions, as I'll be listing bellow:
let sftp = new SFTPClient(myData);
let stream = iconv.decodeStream('utf16le');
sftp.getStream('file', stream)
.then(() => {
stream.pipe(iconv.encodeStream('utf8'))
.pipe(bucket.file('file.csv').createWriteStream({resumable: false}));
res.end(`Result: ${result}`);
})
.catch(err => {
res.end(err);
});
Is there something wrong? Because I don't know what to do to resolve this, I would appreciate if you guys helped me.
javascript node.js ftp sftp
New contributor
So, I've been working on something and I need to stream a file from ftp to gcloud storage and it isn't working. I'm using sftp-promises and iconv to do the transactions, as I'll be listing bellow:
let sftp = new SFTPClient(myData);
let stream = iconv.decodeStream('utf16le');
sftp.getStream('file', stream)
.then(() => {
stream.pipe(iconv.encodeStream('utf8'))
.pipe(bucket.file('file.csv').createWriteStream({resumable: false}));
res.end(`Result: ${result}`);
})
.catch(err => {
res.end(err);
});
Is there something wrong? Because I don't know what to do to resolve this, I would appreciate if you guys helped me.
let sftp = new SFTPClient(myData);
let stream = iconv.decodeStream('utf16le');
sftp.getStream('file', stream)
.then(() => {
stream.pipe(iconv.encodeStream('utf8'))
.pipe(bucket.file('file.csv').createWriteStream({resumable: false}));
res.end(`Result: ${result}`);
})
.catch(err => {
res.end(err);
});
let sftp = new SFTPClient(myData);
let stream = iconv.decodeStream('utf16le');
sftp.getStream('file', stream)
.then(() => {
stream.pipe(iconv.encodeStream('utf8'))
.pipe(bucket.file('file.csv').createWriteStream({resumable: false}));
res.end(`Result: ${result}`);
})
.catch(err => {
res.end(err);
});
javascript node.js ftp sftp
javascript node.js ftp sftp
New contributor
New contributor
New contributor
asked 2 days ago
Tatiana Vitorello
1
1
New contributor
New contributor
What isres
?
– tkausl
2 days ago
2
Put the whole code, so we can give a correct answer, but you have to wrap the stream listeners on a promise and resolve it.
– Marcos Casagrande
2 days ago
add a comment |
What isres
?
– tkausl
2 days ago
2
Put the whole code, so we can give a correct answer, but you have to wrap the stream listeners on a promise and resolve it.
– Marcos Casagrande
2 days ago
What is
res
?– tkausl
2 days ago
What is
res
?– tkausl
2 days ago
2
2
Put the whole code, so we can give a correct answer, but you have to wrap the stream listeners on a promise and resolve it.
– Marcos Casagrande
2 days ago
Put the whole code, so we can give a correct answer, but you have to wrap the stream listeners on a promise and resolve it.
– Marcos Casagrande
2 days ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Tatiana Vitorello is a new contributor. Be nice, and check out our Code of Conduct.
Tatiana Vitorello is a new contributor. Be nice, and check out our Code of Conduct.
Tatiana Vitorello is a new contributor. Be nice, and check out our Code of Conduct.
Tatiana Vitorello is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418164%2fmy-promise-is-not-working-properly-when-trying-to-stream-a-ftp-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is
res
?– tkausl
2 days ago
2
Put the whole code, so we can give a correct answer, but you have to wrap the stream listeners on a promise and resolve it.
– Marcos Casagrande
2 days ago