Skip to content

Commit

Permalink
Rotate images by following orientation
Browse files Browse the repository at this point in the history
  • Loading branch information
otoyo committed Jul 25, 2023
1 parent 39e99fa commit 206c947
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/notion/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs, { createWriteStream } from 'node:fs'
import axios, { AxiosResponse } from 'axios'
import sharp from 'sharp'
import retry from 'async-retry'
import ExifTransformer from 'exif-be-gone'
import {
Expand Down Expand Up @@ -402,7 +403,8 @@ export async function downloadFile(url: URL) {
const filepath = `${dir}/${filename}`

const writeStream = createWriteStream(filepath)
res.data.pipe(new ExifTransformer()).pipe(writeStream)
const rotate = sharp().rotate()
res.data.pipe(rotate).pipe(new ExifTransformer()).pipe(writeStream)
}

export async function getDatabase(): Promise<Database> {
Expand Down

0 comments on commit 206c947

Please sign in to comment.