Skip to content

Instantly share code, notes, and snippets.

@studiotomi
studiotomi / images.js
Last active April 24, 2020 13:17 — forked from eric-sproles-volusion/images.js
Write 404 images
const axios = require('axios');
const fs = require('fs');
const headers = { 'x-vol-tenant': '5c49cda1ddca5800122fad4e' };
const materialApi = 'https://api.material.com/images';
const getImages = async (url, headers) => {
if (!fs.existsSync('404s.txt')) {
fs.writeFileSync('404s.txt', '');
}
const params = {
@studiotomi
studiotomi / string_to_bucket.js
Created January 11, 2023 16:38
String to bucket in javascript
const putS3StringObject = async (bucket, key, str) => {
try {
const s3 = new aws_sdk_1.S3();
const buf = Buffer.from(str);
await s3.putObject({
Key: key,
Bucket: bucket,
Body: buf,
ContentEncoding: 'base64'
}).promise();