npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

seft-parser

v1.0.2

Published

An image parser for Samsung trailer metadata

Downloads

12

Readme

SEFT-parser

SEFT-parser is an image parser for reading Samsung trailer metadata.

This package was written thanks to the analysis that Dr. Neal Krawetz performed and wrote in this blog post

Installation

npm i seft-parser

Vocabulary

  • Record - a type of data.
  • Content - the data in a specific record
  • Value - the actual value of a record

Usage

Initialize the parser with an image file or image data:

const seft = new Seft('your/path/to/image')
// or
const seft = new Seft(image: ArrayBuffer)

Reading metadata

After initialized, you can get a quick access to the metadata in a key:value format by the getMetadata method:

console.log(seft.getMetadata)

// result:
// {
//     Image_UTC_Data: '2023-12-13 14:41:28.110 GMT',
//     Camera_Capture_Mode_Info: '3'
//     ...
// }

Parser

Seft class

The seft object includes the next object:

  • seftVersion: number - indicates the version of the current seft block in the image
  • recordsCount: number - indicates the number of metadata fields recognized in the current seft block in the image.
  • records: SeftRecord - an object containing all the metadata records in the current SEFT segment and relevant data about them.
  • seftMarkerOffset: number - indicates the offset of the SEFT marker from the start of the file
  • sefhMarkerOffset: number - indicates the offset of the SEFH marker from the start of the file
  • headersBlockStartOffset: number - indicates the offset of the starting point of the SEFT headers block from the start of the file. this will normally be the same offset as the sefhMarkerOffset.
  • headersBlockEndOffset: number - indicates the offset of the ending point of the SEFT headers block from the start of the file. this will normally be equal to the offset of seftMarkerOffset + 4.
  • headersBlockLength: number - indicate the length of the headers block in bytes, from the headersBlockStartOffset to headersBlockEndOffset.
  • segmentData: ArrayBuffer - contains only the data of the SEFT metadata segment.

SeftRecord class

The SeftRecord object includes the next object:

  • padding: string - a hex string value of the first two bytes in each record. Mainly be zero value.
  • type: string - a hex string value that represent the record type of data.
  • offsetToContent: number - an offset indicate the starting point of the actual content of the record. This offset is the number of bytes from the sefhMarkerOffset backwards.
  • contentLen: number - the record content length in bytes.
  • content: SeftRecordContent - an object containing all the data about the content of the record.

SeftRecordContent class

The SeftRecordContent object includes the next object:

  • padding: string - a hex string value of the first two bytes in each record content. Mainly be zero value.
  • recordType: string - a hex string value that represent the record type of data. this should be the same as SeftRecord.type of the current record.
  • dataType: string - a string value represents the how this record content data will be parse to a readable value.
  • contentLen: number - the length of the content of the current record in bytes.
  • recordNameLen: number - the length of the record name of the current record in bytes.
  • recordName: string - the name of the current record.
  • recordRawData: ArrayBuffer - row data value of the whole record content.
  • value: any - the content of the record parsed to a readable value (if known).
  • isDOFSRecord: boolean - a flag indicates if the content is an instance of DOFS record. (currently there is no support in parsing DOFS content)

Error handling

No SEFT metadata

If the image / data you provided does not includes any SEFT marker, an error will thrown up with the text Error: No SEFT segment in this data