internetarchive-ts - v0.1.0
    Preparing search index...

    Class IaFile<IaFileMeta>Beta

    This class represents a file in an archive.org item. You can use this class to access the file metadata.

    const item = await getItem('stairs');
    const file = item.getFile('stairs.avi');
    if (file) {
    console.log(`${file.format}, ${file.size}`); // Cinepack, 3786730
    }

    Or to download a file:

    file.download();
    

    This class also uses IA's S3-like interface to delete a file from an item. You need to supply your IAS3 credentials in environment variables in order to delete:

    file.delete();
    

    You can retrieve S3 keys here.

    Type Parameters

    Hierarchy

    Index

    Constructors

    Properties

    item: IaItem

    The item that the file is part of.

    metadata: {
        [K in string | number | symbol]: (
            {
                format: IaFileFormat;
                md5: string;
                mtime: `${number}`;
                name: string;
                size: `${number}`;
                source: IaFileSource;
                [key: string]: IaMetadataValidFieldType
                | IaMetadataValidFieldType[];
            } & Partial<
                IaRawMetadata<Omit<IaFileMeta, keyof IaFileBasicMetadata<string>>>,
            >
        )[K]
    }
    url: string

    Accessors

    Methods

    • Beta

      Returns a string representation of an object.

      Returns string