本文整理匯總了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