$fn.getFile(path)
Retrieves the file at the specified path. "asynchronous"
Arguments
Name | Type | Description |
---|---|---|
path | string | Path of file to be retrieved |
Return value
Type | Description |
---|---|
Promise<{data: Buffer}> | Object with properties of binary data (data: Buffer type) to be retrieved from Amazon S3 |
Sample
try { const file = await $fn.getFile('/note.json'); const buffer = file.data; // JSON object const obj = JSON.parse(buffer.toString()); } catch (err) { console.log("Error", err); }