!!!Joefree!!! π
10/12/2024, 12:01 PM!!!Joefree!!! π
11/24/2024, 8:37 PMAuthGuard
12/07/2024, 1:36 PMAuthGuard
12/07/2024, 4:36 PMAuthGuard
12/07/2024, 7:12 PMAuthGuard
12/08/2024, 10:24 AM!!!Joefree!!! π
02/01/2025, 1:48 PMazzouzana
02/01/2025, 2:20 PM!!!Joefree!!! π
02/01/2025, 2:29 PMAnusha
04/01/2025, 7:02 AM!!!Joefree!!! π
04/10/2025, 10:53 PMjavascript
(async () => {
// SETTING
STORAGE_NAME = 'STORAGE_NAME' // "username~named-kv-storage-name" or "kv-storage-id"
RECORD_NAME = 'RECORD_NAME'
APIFY_TOKEN = 'YOUR_APIFY_TOKEN'
MIME_TYPE = 'application/octet-stream'
// SELECT FILE
const input = Object.assign(document.createElement('input'), { type: 'file', style: 'display: none' })
document.body.appendChild(input); // needed to make it clickable
input.click()
await new Promise(resolve => input.onchange = resolve)
const file = input.files[0]
const buffer = await file.arrayBuffer()
const bytes = new Uint8Array(buffer)
console.log('Bytes:', bytes)
input.remove()
// UPLOAD
const file_url = `https://api.apify.com/v2/key-value-stores/${STORAGE_NAME}/records/${RECORD_NAME}`
console.log('URL:', file_url)
response = await fetch(
`${file_url}?token=${APIFY_TOKEN}`,
{ method: 'PUT', headers: {'content-type': MIME_TYPE}, body: bytes }
).then(res => res.json())
console.log('Response:', response)
})();
PS: this is not a jokeSaurav Jain
05/19/2025, 11:18 AMLouis Deconinck
05/19/2025, 1:45 PM