Skip to content

Commit

Permalink
feat: ensure data directory exists before saving email
Browse files Browse the repository at this point in the history
  • Loading branch information
pomdtr committed Jan 19, 2025
1 parent f708fef commit 1f2d0a3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/inbox/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import PostalMime from 'npm:postal-mime';
import { ensureDir } from "jsr:@std/fs"

export default {
async email(input: ReadableStream<Uint8Array>) {
await ensureDir("data");
const email = await PostalMime.parse(input);
await Deno.writeTextFile("data/email.json", JSON.stringify(email, null, 4));
}
Expand Down

0 comments on commit 1f2d0a3

Please sign in to comment.