This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

itunes-library-migration-assistant
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

itunes-library-migration-assistant

tests

Assists in moving files referenced in an iTunes library. Creates an library file updated with the new file locations.

On NPM here.

npm i itunes-library-migration-assistant

This only works in Node.js, not in the browser, as it uses the file system.

Usage

ES Modules

import {migrateLibrary, MigrationOutput} from 'itunes-library-migration-assistant';

const migratedLibraryFilePath = migrateLibrary({
    libraryFilePath: 'path/to/library.xml',
    replacePaths: [
        {
            old: 'my/old/path/to/file',
            /**
             * Tracks that match the above "old" path will have that part of their path overwritten
             * with the below "new" path.
             */
            new: 'my/fancy/new/path/to/file',
        },
        {
            old: 'old/path/to/files/that/no/longer/exist',

            /** Tracks that match the above "old" path simply won't exist in the final output. */
            delete: true,
        },
    ],
    options: {
        validationEnabled: true,
        loggingEnabled: false,
        checkReplacementPaths: true,
    },
    outputType: MigrationOutput.WriteToFile,
});

CommonJS

const migration = require('itunes-library-migration-assistant');

const migratedLibraryFilePath = migration.migrateLibrary({
    libraryFilePath: 'path/to/library.xml',
    replacePaths: [
        {
            old: 'my/old/path/to/file',
            /**
             * Tracks that match the above "old" path will have that part of their path overwritten
             * with the below "new" path.
             */
            new: 'my/fancy/new/path/to/file',
        },
        {
            old: 'old/path/to/files/that/no/longer/exist',

            /** Tracks that match the above "old" path simply won't exist in the final output. */
            delete: true,
        },
    ],
    options: {
        validationEnabled: true,
        loggingEnabled: false,
        checkReplacementPaths: true,
    },
    outputType: migration.MigrationOutput.WriteToFile,
});

Details

Using MigrationOutput.WriteToFile (as used above) will not overwrite the original library.xml file. The returned migratedLibraryFilePath is the new file path.

More info

See types in .d.ts files for more info. There are lots of test files but those are excluded from the NPM package. They can instead be found in the git repo, here.

Package Sidebar

Install

npm i itunes-library-migration-assistant

Weekly Downloads

1

Version

0.4.0

License

MIT

Unpacked Size

43.6 kB

Total Files

37

Last publish

Collaborators

  • electrovir