Home

Awesome

Build Status NPM version npm downloads Known Vulnerabilities Total alerts Language grade: JavaScript DeepScan grade

@music-metadata/s3

Extension for music-metadata to retrieve metadata from files stored on Amazon Web Services (AWS) S3 cloud storage.

The magic of this module is, it is able to extract the metadata from your audio files, without downloading and parsing the entire file.

This module is integrating @tokenizer/s3, for reading from the S3 cloud, and using music-metadata to parse the audio file.

Deprecated

This module is deprecated. It has become obsolete with @tokenizer/s3. You may want to use this example as starting point.

Installation

npm install @music-metadata/s3

Reading audio metadata from Amazon S3

Read metadata from 'My audio files/01 - My audio track.flac' stored in the S3 cloud:

const { parseS3Object } = require('@music-metadata/s3');
const S3 = require('aws-sdk/clients/s3');

(async () => {

  const s3 = new S3();

  console.log('Parsing...');
  try {
    const data = await parseS3Object(s3, {
        Bucket: 'your-bucket',
        Key: 'My audio files/01 - My audio track.flac'
      }
    );
    console.log('metadata:', data);
  } catch (e) {
    console.error(`Oops: ${e.message}`);
  }
})();

Using conventional streaming using the disableChunked flag:

const { parseS3Object } = require('@music-metadata/s3');
const S3 = require('aws-sdk/clients/s3');

(async () => {

  const s3 = new S3();
  
  console.log('Parsing...');
  try {
    const data = await parseS3Object(s3, {
        Bucket: 'your-bucket',
        Key: 'My audio files/01 - My audio track.flac'
      }, {
        disableChunked: true // Disable chunked transfer
      }
    );
    console.log('metadata:', data);
  } catch (e) {
    console.error(`Oops: ${e.message}`);
  }
})();

Options

optiontypedescription
disableChunkedbooleanset to true to switch to conventional sequential streaming.

Other options are inherited from music-metadata

Dependency graph

dependency graph