Skip to content

Instantly share code, notes, and snippets.

@bkardell
Last active May 6, 2024 05:09
Show Gist options
  • Save bkardell/cf12824c6265fef369adade162327e5d to your computer and use it in GitHub Desktop.
Save bkardell/cf12824c6265fef369adade162327e5d to your computer and use it in GitHub Desktop.
import fetch from 'node-fetch';
export async function requestSnapshot(url, data) {
const response = await fetch('https://little-paper-d118.bkardell.workers.dev', {
method: 'POST',
mode: 'no-cors',
headers: {url: url}
});
response
.text()
.then(
(f) => { console.log("Requested Internet Archiving", f); }
).catch(
(x) => { console.error("Unable to request Internet Archiving", x); }
)
}
@bkardell
Copy link
Author

bkardell commented Mar 3, 2020

usage

import { requestSnapshot } from './archive.mjs';

// pass it whatever URL
requestSnapshot('https://www.11ty.dev/')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment