xoeye / gps-metadata-remover

Javascript package that removes GPS metadata from images and videos
Other
9 stars 3 forks source link

Typescript support #23

Closed etczrn closed 6 months ago

etczrn commented 2 years ago

Hello, do you have a plan for supporting TypeScript? I desperately want that feature.

Aleclindner commented 2 years ago

This should be a pretty easy conversion, I can get to it soon.

tycrek commented 1 year ago

Any update on this?

tycrek commented 1 year ago

I wrote this for my own codebase, works well enough for me. Not sure how it would be adapted for publishing though.

gps-metadata-remover.d.ts

type ReadFunction = (size: number, offset: number) => Promise<Buffer>
type WriteFunction = (writeValue: string, entryOffset: number, encoding: string) => Promise<void>
type Options = {
    skipXMPRemoval?: boolean
}

declare module '@xoi/gps-metadata-remover' {
    export async function removeLocation(photoUri: string, read: ReadFunction, write: WriteFunction, options: Options = {}): Promise<boolean>
    export async function arrayBufferToBase64(buffer: ArrayBuffer): string
    export async function base64StringToArrayBuffer(base64String: string): Promise<Buffer>
}
Aleclindner commented 1 year ago

I'll check this out this week and do a release if it looks good.

danielxoi commented 6 months ago

This should be resolved in the latest release https://github.com/xoeye/gps-metadata-remover/releases/tag/v2.0.0