Skip to content

$fn.getFile(path)

Retrieves the file at the specified path. "asynchronous"

Arguments

NameTypeDescription
pathstringPath of file to be retrieved

Return value

TypeDescription
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);
}