Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Dec 6, 2023
1 parent 07661fd commit aa1fc0b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/__tests__/ffmpeg.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { generateInfo } from '../ffmpeg'
import { PouchDBMediaDocument } from '../db'
import path from 'path'
import moment from 'moment'

// eslint-disable-next-line @typescript-eslint/no-var-requires
const targetVersions = require('./ffmpegReleases.json')

const testMediaPath = path.join(__dirname, 'samples')
Expand Down
4 changes: 2 additions & 2 deletions src/ffmpeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const statAsync = util.promisify(fs.stat)
const unlinkAsync = util.promisify(fs.unlink)
const readFileAsync = util.promisify(fs.readFile)

export async function generateThumb(config: Record<string, any>, doc: PouchDBMediaDocument) {
export async function generateThumb(config: Record<string, any>, doc: PouchDBMediaDocument): Promise<void> {
const tmpPath = path.join(os.tmpdir(), Math.random().toString(16)) + '.png'

const args = [
Expand Down Expand Up @@ -53,7 +53,7 @@ export async function generateThumb(config: Record<string, any>, doc: PouchDBMed
await unlinkAsync(tmpPath)
}

export async function generateInfo(config: Record<string, any>, doc: PouchDBMediaDocument) {
export async function generateInfo(config: Record<string, any>, doc: PouchDBMediaDocument): Promise<void> {
const json = await new Promise((resolve, reject) => {
const args = [
// TODO (perf) Low priority process?
Expand Down
4 changes: 3 additions & 1 deletion tools/fetch_ffmpeg.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { promisify } from 'node:util'
import { createWriteStream } from 'node:fs'
import path from 'path'
import cp from 'child_process'
import targetVersions from '../src/__tests__/ffmpegReleases.json' assert { type: 'json' }

const targetVersions = JSON.parse(await fs.readFile('./src/__tests__/ffmpegReleases.json'))

const toPosix = (str) => str.split(path.sep).join(path.posix.sep)

Expand Down Expand Up @@ -35,6 +36,7 @@ if (platformVersions) {
console.log(`Fetching ${version.url}`)
// Download it

// eslint-disable-next-line no-undef
const response = await fetch(version.url)
if (!response.ok) throw new Error(`unexpected response ${response.statusText}`)
await streamPipeline(response.body, createWriteStream(tmpPath))
Expand Down

0 comments on commit aa1fc0b

Please sign in to comment.