React Native utility library around image and video files for getting metadata like MIME type, timestamp, duration, and dimensions. Works on iOS and Android using Java and Obj-C, instead of Node 🚀.

Overview

Qeepsake React Native File Utils

Extracts information from image and video files including MIME type, duration (video), dimensions, and timestamp. The library work on iOS and Android and uses Java and Obj-C native library (not Node).

Installation

npm install @qeepsake/react-native-file-utils

Usage

Get the duration of video file

Gets the duration of the video in seconds.

import { getVideoDuration } from '@qeepsake/react-native-file-utils';

const durationMs = await getVideoDuration('file://<media-path>');

Get the media file dimensions in pixels

Gets the horizontal (x) and vertical (y) pixels of the media item, either image or video. The returned media dimensions includes an object with both the horizontal (x) length in pixels and vertical (y) length in pixels.

import { getDimensions } from '@qeepsake/react-native-file-utils';

const mediaDimensions = await getDimensions('file://<media-path>', 'video');

Get the MIME type of a media item file

Gets the MIME type of the media file at the passed Uri.

import { getMimeType } from '@qeepsake/react-native-file-utils';

const mimeType = await getMimeType('file://<media-path>');

Get the timestamp of a media item file

Gets the string timestamp of the media file from the passed Uri. The timestamp is usually a date retrieved from either the Exif date if the original datetime of the media is available or by the creation/last modified timestamp from the file itself.

import { getTimestamp } from '@qeepsake/react-native-file-utils';

const timestamp = await getTimestamp('file://<media-path>', 'video');

Supported Schemes

In this table, you can see what type of URI can be handled by each method.

Method Name iOS Android
getTimestamp file://, assets-library:// file://, content://
getVideoDuration file:// file://
getMimeType file://, ph:// file://, content://
getDimensions file://, file://

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

You might also like...
iOS 15 share play API in react-native

react-native-shareplay iOS 15 share play API in react-native Installation yarn add react-native-shareplay And go to Xcode Capabilities and enable "Gro

POC for a bug with react-native-webview crashing on IOS 16.1

POC Shared Worker issues with IOS 16.1 webview Apple Developers post with workaround Webkit confirmed issue Start a simple http server with shared wor

Discover Movies and TV shows -  React Native
Discover Movies and TV shows - React Native

movieapp Discover Movies and TV shows Download APK file Download from Google Drive - v2.2.1 What's included Name Description React Native Build Native

Bridge between onfido-auth and react-native

react-native-onfido-auth-sdk Table of contents Overview Installation Usage 1. Creating the SDK configuration 2. Parameter details 3. Success Response

React Native 实现无侵入自定义下拉刷新组件
React Native 实现无侵入自定义下拉刷新组件

react-native-ly-refresh-control 下拉刷新 iOS 基于MJRefresh 通过RCTCustomRefreshContolProtocol实现RefreshControl组件封装 JS端可以无侵入自定义下拉刷新只需要替换对应的refreshControl Androi

React Native package for interacting with HomeKit devices

React Native package for interacting with HomeKit devices

react native esptouch

react-native-esptouch One should know that This is a Unofficial project. The official demo is below: EsptouchForAndroid EsptouchForIOS Getting started

React Native Template for Taro

React Native Template for Taro requirement taro: @tarojs/cli@^3.2.0 framework: 'react' quick start install react native library install peerDependenci

A suite of IoT tools to use with React Native.

react-native-iot-tools WIP. A suite of IoT tools for React Native applications. Package iOS Android @react-native-iot-tools/bluetooth ✅ ❌ @react-nativ

Comments
  • CLI App Build Error

    CLI App Build Error

    Have an app that when running gradlew assembleRelease

    i get the following error. This worked before upgrading to expo sdk 46 and react-native 0.69

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':qeepsake_react-native-file-utils:verifyReleaseResources'.

    A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action Android resource linking failed ERROR:/Users/riogrande100/.gradle/caches/transforms-3/7dad25162e0ba98f9fd2ff8ab8cdde1c/transformed/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.

    any ideas?

    opened by riogrande100 3
  • fix(timestamp-format): Update readme and return string type from getTimestamp

    fix(timestamp-format): Update readme and return string type from getTimestamp

    Attempted returning JS Date always from getTimestamp but saw that Exif metadata could possibly come in a bunch of different formats, and is natively pulled out as strings from iOS and Android. So after seeing that, thought it might be better to keep this library closer to the metal and return the string from native. Any thoughts on this @lukebrandonfarrell ?

    released 
    opened by tdbrian 2
  • fix(timestamp): android virtual method 'int java.lang.String.length()' on a null object reference

    fix(timestamp): android virtual method 'int java.lang.String.length()' on a null object reference

    Story: https://qeepsake.atlassian.net/browse/ENG-1545 Sentry: https://sentry.io/organizations/qeepsake/issues/3081765214/events/e65c4c07c6b447d99fabb1e8dabc4af0/?project=273486

    released 
    opened by lukebrandonfarrell 1
  • Feature/add implementations

    Feature/add implementations

    Sets up initial implementations on iOS and Android for the following utility methods:

    • getDuration
    • getDimensions
    • getMimeType
    • getTimestamp

    Each method is documented in the code, but the general usage of each is passing in the the full file path, URI, of either an image or video asset. Each utility method will in some way, depending on the platform, get the method data from the file or file metadata. All of the methods, except, getDuration (since it's only valid for video), require passing passing either 'image' or 'video' as the second argument so we can determine the best way to get the required information from the media type.

    opened by tdbrian 0
Releases(v1.3.4)
Owner
Qeepsake
:wave: Welcome to Qeepsake Engineering. We build software to enhance the joy and affection families share by capturing moments and milestones along the journey.
Qeepsake
Blazing⚡️Fast BTC and ETH Wallet Generator library for React Native, Android and iOS

Blazing ⚡️ Fast BTC and ETH Wallet Generator library for React Native, Android and iOS.

Coingrig 3 Feb 21, 2022
iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android).

FinanceReactNative iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android). Data is pulled from Yahoo Finance

kf 2k Dec 29, 2022
React Native library that implements PayPal Checkout flow using purely native code (swift).

react-native-paypal-swift React Native library that implements PayPal Checkout flow using purely native code (swift). Installation npm install react-n

Tibb 6 Nov 28, 2022
🏀 iOS and Android NBA app created with React Native

Swish An iOS and Android NBA app created with React Native. If you would like to request a feature, find a bug, have a question, or would like to leav

James Kuczmarski 108 Nov 11, 2022
Ported scrcpy for mobile platforms, to remotely control Android devices on your iPhone or Android phone.

scrcpy-mobile Ported scrcpy for mobile platforms, to remotely control Android devices on your iPhone or Android phone. Currently only supports control

Ethan 140 Jan 2, 2023
This provides a bridge to use Sync with Tokamak instead of SwiftUI

Sync Tokamak This provides a bridge to use Sync with Tokamak instead of SwiftUI.

Mathias Quintero 5 May 7, 2022
A react native interface for integrating payments using Braintree

A react native interface for integrating payments using Braintree

eKreative 17 Dec 30, 2022
A property finder application written using React Native

React Native PropertyFinder App This repository accompanies the tutorial I published on Ray Wenderlich's website, which describes the process of build

Colin Eberhardt 276 Aug 14, 2022
A testing MQTT react native library

react-native-awesome-testing abc Installation npm install react-native-awesome-testing Usage import { multiply } from "react-native-awesome-testing";

null 0 Nov 26, 2021
Allows you to emulate an Android native library, and an experimental iOS emulation

unidbg Allows you to emulate an Android native library, and an experimental iOS emulation. This is an educational project to learn more about the ELF/

Banny 2.5k Dec 30, 2022