Function createDelta

  • Given a source and a destination image, invokes /images/delta and returns a promise to a readable stream for following progress. Can also be called with a callback as the second argument instead, similar to how Dockerode methods support both a callback and async interface.

    Callers can extract the delta image ID by parsing the stream like so:

    const stream = await docker.createDelta({ src, dest });
    const deltaId = await new Promise<string>((resolve, reject) => {
    let imageId: string | undefined = null;
    function onFinish(err) {
    if (err != null) {
    return reject(err);
    }
    if (imageId == null) {
    return reject(new Error('failed to parse delta image ID!'));
    }
    resolve(imageId);
    }
    docker.modem.followProgress(stream, onFinish, (e: any) => {
    const match = /^Created delta: (sha256:\w+)$/.exec(e.status);
    if (match && imageId == null) {
    imageId = match[1];
    }
    });
    });

    Deltas are currently only available with balenaEngine, but this method makes no effort to determine whether that's the case.

    Parameters

    Returns Promise<NodeJS.ReadableStream>

  • Parameters

    Returns void

Generated using TypeDoc