BagItUtil

BagItUtil

BagItUtil contains some static utility functions to help with BagIt profiles.

Constructor

new BagItUtil()

Source:

Methods

(static) _getProfileName(sourceUrl) → {string}

This returns a name and description for an imported profile. This is not necessary for profiles conforming to https://github.com/bagit-profiles/bagit-profiles/, but it is useful for Library of Congress profiles.

If sourceUrl is supplied, this returns a profile name based on the file name at the end of the url. For example, if sourceUrl is https://example.com/basic_profile.json, this returns "Profile imported from https://example.com/basic_profile.json". Otherwise, it returns "Imported Profile "

Parameters:
Name Type Description
sourceUrl string
Source:

(static) guessProfileType(obj) → {string}

This function tries to guess the type of BagIt Profile based on the keys in the profile object. Returns one of the following:

  • "bagit_profiles" - This profile is of the type described in the bagit-profiles GitHub repo.
  • "loc_unordered" - This is an unordered Library of Congress profile, like the example at other-project-profile.json
  • "loc_ordered" - An ordered Library of Congress profile, like the SANC State Profile
  • "dart" - A DART BagIt profile, like the APTrust BagIt Profile
  • "unknown" - Cannot identify profile type.

The great thing about standards is that there are so many of them.

Parameters:
Name Type Description
obj object
Source:

(static) profileFromLOC(obj, sourceUrl) → {BagItProfile}

Converts an unordered Library of Congress BagIt profile like the other-project-profile.json profile to a DART BagIt profile.

Parameters:
Name Type Description
obj object
sourceUrl string

Optional URL from which profile was imported.

Source:

(static) profileFromLOCOrdered(obj, sourceUrl) → {BagItProfile}

Converts an ordered Library of Congress BagIt profile like the SANC-state-profile.json profile to a DART BagIt profile.

Parameters:
Name Type Description
obj object

The profile to import.

sourceUrl string

Optional URL from which profile was imported.

Source:

(static) profileFromStandardJson(jsonString) → {BagItProfile}

This function converts a standard BagIt profile, like the ones described at https://github.com/bagit-profiles/bagit-profiles into a DART BagIt profile.

Parameters:
Name Type Description
jsonString string

The raw JSON BagIt profile to convert.

Source:
See:

(static) profileFromStandardObject(obj) → {BagItProfile}

This function converts a standard BagIt profile object, like the ones described at https://github.com/bagit-profiles/bagit-profiles into a DART BagIt profile.

If you want to convert a standard profile directly from a JSON string, see profileFromStandardJson.

Parameters:
Name Type Description
obj Object

The BagIt profile to convert.

Source:
See:

(static) profileToStandardJson(profile) → {string}

This function converts a DART BagItProfile object to a JSON string in the format described at https://github.com/bagit-profiles/bagit-profiles.

Note that a considerable amount of tag-related information will be lost in the conversion, since the GitHub BagIt profiles do not support as rich a set of information as DART profiles.

Parameters:
Name Type Description
profile BagItProfile

A DART BagItProfile object.

Source:
See:

(static) profileToStandardObject(p) → {Object}

This function converts a DART BagItProfile object to the format described at https://github.com/bagit-profiles/bagit-profiles.

Note that a considerable amount of tag-related information will be lost in the conversion, since the GitHub BagIt profiles do not support as rich a set of information as DART profiles.

Parameters:
Name Type Description
p BagItProfile

A DART BagItProfile object.

Source:
See: