Delete get_image.js

This commit is contained in:
5vl 2023-04-06 21:25:41 +02:00 committed by GitHub
parent 552d1bbd07
commit b5438207bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,22 +0,0 @@
// To use any npm package on Pipedream, just import it
import axios from "axios"
import Path from 'path'
import fs from 'fs'
export default defineComponent({
async run({ steps, $ }) {
let url = ""
await axios.get("https://api.thecatapi.com/v1/images/search?mime_types=jpg,png&api_key=API_KEY").then((res) => {
url = res.data[0].url
})
const path = Path.resolve('/tmp', 'cat.jpg')
const { data } = await axios({
method: 'GET',
url,
responseType: 'arraybuffer',
})
fs.writeFileSync(path, data)
return url
},
})