本文整理汇总了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
示例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