Working with non-tabular files
Load a single file
import redivis from 'redivis';
// See https://redivis.com/datasets/yz1s-d09009dbb/files for example data
const table = redivis.table('demo.example_data_files:yz1s:v1_3.example_file_types:4c10');
const textFile = await table.file('pandas_core.py');
const imageFile = await table.file('bogota.tiff');
// Read file contents
const text = await textFile.read({ asText: true });
const bytes = await imageFile.read(); // A Uint8Array
// Read part of a file
const firstKilobyte = await imageFile.read({ startByte: 0, endByte: 1023 });
// Stream the file, as a ReadableStream
const stream = textFile.stream();
// Download the file (Node.js only)
await imageFile.download('./path/'); // Downloaded as ./path/bogota.tiff
await textFile.download('./path/renamed.txt'); // Downloaded as ./path/renamed.txtLoad all files in a table
Display an image in the browser
Pipe a file to disk in Node.js
Was this helpful?

