forked from metarhia/Example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
File transfer in base64 over metacom
PR-URL: metarhia#39
- Loading branch information
1 parent
e527693
commit 66a74e1
Showing
2 changed files
with
61 additions
and
2 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,9 @@ | ||
async ({ name, data }) => { | ||
const buffer = Buffer.from(data, 'base64'); | ||
const tmpPath = 'application/tmp'; | ||
const filePath = node.path.join(tmpPath, name); | ||
if (filePath.startsWith(tmpPath)) { | ||
await node.fsp.writeFile(filePath, buffer); | ||
} | ||
return { uploaded: data.length }; | ||
}; |
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