当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript sharp.queue类代码示例

本文整理汇总了TypeScript中sharp.queue的典型用法代码示例。如果您正苦于以下问题:TypeScript queue类的具体用法?TypeScript queue怎么用?TypeScript queue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了queue类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: sharp

        // output.jpg is a 300 pixels wide and 200 pixels high image
        // containing a scaled and cropped version of input.jpg
    });

let transformer = sharp()
    .resize(300)
    .on('info', (info: sharp.OutputInfo) => {
        console.log('Image height is ' + info.height);
    });
readableStream.pipe(transformer).pipe(writableStream);

console.log(sharp.format);
console.log(sharp.versions);

sharp.queue.on('change', (queueLength: number) => {
    console.log('Queue contains ' + queueLength + ' task(s)');
});

let pipeline: sharp.SharpInstance = sharp().rotate();
pipeline.clone().resize(800, 600).pipe(writableStream);
pipeline.clone().extract({ left: 20, top: 20, width: 100, height: 100 }).pipe(writableStream);
readableStream.pipe(pipeline);
// firstWritableStream receives auto-rotated, resized readableStream
// secondWritableStream receives auto-rotated, extracted region of readableStream

const image: sharp.SharpInstance = sharp(input);
image
    .metadata()
    .then<Buffer|undefined>((metadata: sharp.Metadata) => {
        if (metadata.width) {
            return image
开发者ID:minodisk,项目名称:DefinitelyTyped,代码行数:31,代码来源:sharp-tests.ts

示例2: sharp

        // output.jpg is a 300 pixels wide and 200 pixels high image
        // containing a scaled and cropped version of input.jpg
    });

let transformer = sharp()
    .resize(300)
    .on('info', (info: sharp.OutputInfo) => {
        console.log('Image height is ' + info.height);
    });
readableStream.pipe(transformer).pipe(writableStream);

console.log(sharp.format);
console.log(sharp.versions);

sharp.queue.on('change', (queueLength: number) => {
    console.log(`Queue contains ${queueLength} task(s)`);
});

let pipeline: sharp.SharpInstance = sharp().rotate();
pipeline.clone().resize(800, 600).pipe(writableStream);
pipeline.clone().extract({ left: 20, top: 20, width: 100, height: 100 }).pipe(writableStream);
readableStream.pipe(pipeline);
// firstWritableStream receives auto-rotated, resized readableStream
// secondWritableStream receives auto-rotated, extracted region of readableStream

const image: sharp.SharpInstance = sharp(input);
image
    .metadata()
    .then<Buffer|undefined>((metadata: sharp.Metadata) => {
        if (metadata.width) {
            return image
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:31,代码来源:sharp-tests.ts


注:本文中的sharp.queue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。