Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

react-native-get-music-files-v3dev-test

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-get-music-files-v3dev-test

A module to scan media files

latest
Source
npmnpm
Version
3.1.5
Version published
Maintainers
1
Created
Source

react-native-get-music-files

Instalation

$ npm i react-native-get-music-files-v3dev-test

Imports

import MusicFiles, {
  Constants,
  CoverImage
} from "react-native-get-music-files-v3dev-test";

Constants

{
  SortBy: {
    Artist: 'ARTIST',
    Album: 'ALBUM',
    Title: 'TITLE',
  },
  SortOrder: {
    Ascending: 'ASC',
    Descending: 'DESC',
  },
}

example


import {Constants} from 'react-native-get-music-files-v3dev-test';

const sortBy = Constants.SortBy.Title,
const sortOrder = Constants.SortOrder.Ascending,

Methods

options

all attributes of the options object are optional

{
  searchParam?: string,
  batchNumber?: string,
  batchSize?: string,
  sortBy?: string,
  sortOrder?: string,
}

returns

{
  "results": {
    id: number,
    path: string,
    duration: number,
    album: string,
    artist: string,
    title: string
    }[],
  "length": number
}

example


search = searchParam => {
      MusicFiles.search({
        "searchParam",
        batchSize: 0,
        batchNumber: 0,
        sortBy: Constants.SortBy.Title,
        sortOrder: Constants.SortOrder.Ascending,
      })
        .then(f => {
          console.log(f);
        })
        .catch(er => console.log(e));
    };

getAll

options

all attributes are optional

{
  cover?: boolean,
  coverFolder?: string,
  minimumSongDuration?: number,
  batchSize?: number,
  batchNumber?: number,
  sortBy?: string,
  sortOrder?: string,
}

returns

{
  "results":{
    id: number,
    path: string,
    cover: string,
    duration: number,
    album: string,
    artist: string,
    title: string

  }[],
  "length" : number
}

example

getAll = () => {
  MusicFiles.getAll({
    cover: false,
    batchSize: 0,
    batchNumber: 0,
    sortBy: Constants.SortBy.Title,
    sortOrder: Constants.SortOrder.Ascending
  })
    .then(f => {
      console.log(f);
    })
    .catch(er => console.log(e));
};

getSongByPath

options

all attributes are optional

{
  cover?: boolean,
  coverFolder?: string,
  path?: string,
}

returns

{
  id: number,
  path: string,
  cover: string,
  duration: number,
  album: string,
  artist: string,
  title: string
}[]

example

getSongByPath = () => {
  MusicFiles.getSongsByPath({
    cover: true,
    coverFolder: "pathToCoverFolder",
    path: "pathToSong"
  })
    .then(f => {
      console.log(f);
    })
    .catch(er => console.log(e));
};

getSongByPaths

scans a directory

options

{
  path: string,
  minFileSize: number,
  maxFileSize: number,
  extensionFilter: string,
}[]

returns

{
  id: number,
  path: string,
  cover: string,
  duration: number,
  album: string,
  artist: string,
  title: string
}[]

example

getSongByPaths = () => {
  MusicFiles.getSongsByPaths({
    path: "URI",
    minFileSize: 0,
    maxFileSize: 1024,
    extensionFilter: ".mp3"
  })
    .then(f => {
      console.log(f);
    })
    .catch(er => console.log(e));
};

getArtists

options

all attributes are optional

{
batchSize?: number,
batchNumber?: number,
sortBy?: string,
sortOrder?: string,
}

returns

{
  "results": {
    artist: string,
    numberOfAlbums: number,
    numberOfSongs: number,
  }[],
  "length": number
}

example

getArtists = () => {
  MusicFiles.getArtists({
    batchSize: 0,
    batchNumber: 0,
    sortBy: Constants.SortBy.Artist,
    sortOrder: Constants.SortOrder.Ascending
  })
    .then(f => {
      console.log(f);
    })
    .catch(er => console.log(e));
};

getAlbums

options

all attributes are optional

{
artist?: string,
batchSize?: number,
batchNumber?: number,
sortBy?: string,
sortOrder?: string,
}

returns

{
  results": {
    id: string,
    album: string,
    artist: string,
    numberOfSongs: number,
    firstYear: number,
    lastYear: number,
  }[],
  "length": number
}

example

getAlbums = () => {
  MusicFiles.getAlbums({
    artist: "searchParam",
    batchSize: 0,
    batchNumber: 0,
    sortBy: Constants.SortBy.Artist,
    sortOrder: Constants.SortOrder.Ascending
  })
    .then(f => {
      console.log(f);
    })
    .catch(er => console.log(e));
};

getSongs

options

all attributes are optional

{
artist?: string,
album?: string,
batchSize?: number,
batchNumber?: number,
sortBy?: string,
sortOrder?: string,
}

returns

{
 "results": {
     id: string,
     title: string,
     album: string,
     artist: string,
     duration: number,
     path: string,
 }[],
 "length": number
}

example

getSongs = () => {
  MusicFiles.getSongs({
    artist: "artist",
    album: "album",
    batchSize: 0,
    batchNumber: 0,
    sortBy: Constants.SortBy.Artist,
    sortOrder: Constants.SortOrder.Ascending
  })
    .then(f => {
      console.log(f);
    })
    .catch(er => console.log(e));
};

Components

use this component instead of cover: true for better performance.

inherits from Image.

<CoverImage src={"pathToSong"} width={120} height={120} />

Example

https://github.com/Drazail/react-native-get-music-files/blob/v3dev/example/App.js

Keywords

react-native

FAQs

Package last updated on 27 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts