When using S3Client.uploadLocalDirectory, a cache is used to skip files that have already been uploaded to S3. Call this method to clear the cache and upload all files in the directory.
Upload file content to S3.
import { S3Client } from '@reuters-graphics/graphics-bin';
const s3 = new S3Client();
const fileData = fs.readFileSync('data.json', 'utf8');
await s3.uploadFile(fileData, 'testfiles/2024/my-project/data.json');
File content
Path in S3 bucket to upload file to
File upload options
Upload a local file to S3.
import { S3Client } from '@reuters-graphics/graphics-bin';
const s3 = new S3Client();
await s3.uploadLocalFile('data.json', 'testfiles/2024/my-project/data.json');
graphics s3:upload data.json testfiles/2024/my-project/data.json
Description
Upload a file to S3
Usage
$ graphics s3:upload <filePath> <bucketPath> [options]
Options
-h, --help Displays this message
Absolute or relative path to a file to upload
Path in S3 bucket to upload file to
File upload options
Upload all files in a local directory to S3.
import { S3Client } from '@reuters-graphics/graphics-bin';
const s3 = new S3Client();
await s3.uploadLocalDirectory('dist', 'testfiles/2024/my-project');
graphics s3:upload-dir dist testfiles/2024/my-project
Description
Upload all files in a directory to S3
Usage
$ graphics s3:upload-dir <dirPath> <bucketPath> [options]
Options
-h, --help Displays this message
Absolute or relative path to directory to upload
Root path in S3 bucket to upload files in the directory to
Directory upload options
💀💀💀 DANGEROUSLY delete a directory in S3.
Note: Directories must be at least 3 levels deep. This method is a no-op in CI environments.
import { S3Client } from '@reuters-graphics/graphics-bin';
const s3 = new S3Client();
await s3.dangerouslyDeleteS3Directory('testfiles/2024/my-project');
graphics s3:dangerously-delete-dir testfiles/2024/my-project/
Description
DANGEROUSLY delete all files in an S3 directory
Usage
$ graphics s3:dangerously-delete-dir <bucketPath> [options]
Options
-f, --force Do not prompt for confirmation before deleting
-h, --help Displays this message
Path to directory to delete, e.g., testfiles/2024/my-project/
If true
, will not prompt the user to confirm before deleting
S3 client.
Note: Authentication is handled via OnePasswordClient.