Readme

This val is part of the SteamPlaytimeHistory project

This val exports the entire play_history table into a csv and emails it to you once a week for backup

Runs every 7 days
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { db, play_history } from "https://esm.town/v/alvi/SteamPlaytimeHistory_playHistorySchema";
import { email } from "https://esm.town/v/std/email";
import { json2csv } from "npm:json-2-csv";
export default async function(interval: Interval) {
const complete_play_history = await db.select().from(play_history).all();
const csv = json2csv(complete_play_history);
const stdEmailAttachmentExample = email({
text: "Complete play history backup",
subject: "Complete play history backup",
attachments: [
{
content: btoa(unescape(encodeURIComponent(csv))),
filename: "complete_play_history_backup.csv",
type: "text/csv",
disposition: "attachment",
},
],
});
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
v5
June 6, 2024