How to use the qiniu.fop function in qiniu

To help you get started, we’ve selected a few qiniu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qiniu / nodejs-sdk / examples / prefop.js View on Github external
const qiniu = require('qiniu');

// var persistentId = 'z0.594b66f745a2650c99aa9e57';
var persistentId = 'na0.58df4eee92129336c2075195';
var config = new qiniu.conf.Config();
config.useHttpsDomain = true;
var operManager = new qiniu.fop.OperationManager(null, config);
// 持久化数据处理返回的是任务的persistentId,可以根据这个id查询处理状态
operManager.prefop(persistentId, function (err, respBody, respInfo) {
    if (err) {
        console.log(err);
        throw err;
    }

    if (respInfo.statusCode == 200) {
        console.log(respBody.inputBucket);
        console.log(respBody.inputKey);
        console.log(respBody.pipeline);
        console.log(respBody.reqid);
        respBody.items.forEach(function (item) {
            console.log(item.cmd);
            console.log(item.code);
            console.log(item.desc);
github mpcast / mpcast-server / src / common / service / qiniu.js View on Github external
// 转码所使用的队列名称。
    const pipeline = 'abc';

    // 要进行转码的转码操作。
    let fops = "avthumb/mp4/s/640x360/vb/1.25m"

    // 可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当前空间
    const saveas_key = qiniu.util.urlsafeBase64Encode(saved_bucket + ':' + saved_key);
    fops = fops + '|saveas/' + saveas_key;
    // console.log(saveas_key);
    const opts = {
      pipeline: pipleline
    };

    const PFOP = qiniu.fop.pfop(bucket, key, fops, opts, function (err, ret) {
      if (!err) {
        console.log(ret);
        // 上传成功, 处理返回值
        // console.log('curl ' + 'http://api.qiniu.com/status/get/prefop?id=' + ret.persistentId);
      } else {
        // 上传失败, 处理返回代码
        // console.log(err);
      }
    });
  }
github arterli / CmsWing / src / common / service / qiniu.js View on Github external
//转码所使用的队列名称。
       let pipeline = 'abc';

//要进行转码的转码操作。
       let fops = "avthumb/mp4/s/640x360/vb/1.25m"

//可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当前空间
        let saveas_key = qiniu.util.urlsafeBase64Encode(saved_bucket+':'+saved_key);
        fops = fops+'|saveas/'+saveas_key;
      // console.log(saveas_key);
       let opts = {
            pipeline: pipleline
        };

        var PFOP = qiniu.fop.pfop(bucket, key, fops, opts, function(err, ret) {
            if(!err) {
                console.log(ret);
                // 上传成功, 处理返回值
                console.log('curl '+'http://api.qiniu.com/status/get/prefop?id='+ret.persistentId);
            } else {
                // 上传失败, 处理返回代码
                console.log(err);
            }
        });
    }
    async download(key){
github arterli / CmsWing / src / controller / ext / attachment / service / qiniu.js View on Github external
// 转码所使用的队列名称。
    const pipeline = 'abc';

    // 要进行转码的转码操作。
    let fops = 'avthumb/mp4/s/640x360/vb/1.25m';

    // 可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当前空间
    const saveas_key = qiniu.util.urlsafeBase64Encode(saved_bucket + ':' + saved_key);
    fops = fops + '|saveas/' + saveas_key;
    // console.log(saveas_key);
    const opts = {
      pipeline: pipleline
    };

    var PFOP = qiniu.fop.pfop(bucket, key, fops, opts, function(err, ret) {
      if (!err) {
        console.log(ret);
        // 上传成功, 处理返回值
        console.log('curl ' + 'http://api.qiniu.com/status/get/prefop?id=' + ret.persistentId);
      } else {
        // 上传失败, 处理返回代码
        console.log(err);
      }
    });
  }
  async download(key) {
github qiniu / nodejs-sdk / examples / video_pfop.js View on Github external
const qiniu = require('qiniu');
const proc = require('process');

var accessKey = proc.env.QINIU_ACCESS_KEY;
var secretKey = proc.env.QINIU_SECRET_KEY;
var mac = new qiniu.auth.digest.Mac(accessKey, secretKey);
var config = new qiniu.conf.Config();
// config.useHttpsDomain = true;
config.zone = qiniu.zone.Zone_z1;
var operManager = new qiniu.fop.OperationManager(mac, config);

// 处理指令集合
var saveBucket = proc.env.QINIU_TEST_BUCKET;
var fops = [
    'avthumb/mp4/s/480x320/vb/150k|saveas/' + qiniu.util.urlsafeBase64Encode(
        saveBucket + ':qiniu_480x320.mp4'),
    'vframe/jpg/offset/10|saveas/' + qiniu.util.urlsafeBase64Encode(saveBucket +
    ':qiniu_frame1.jpg')
];
var pipeline = 'jemy';
var srcBucket = 'if-bc';
var srcKey = 'qiniu.mp4';

var options = {
    notifyURL: 'http://api.example.com/pfop/callback',
    force: false
github bugulink / bugu-web / src / middlewares / cdn.js View on Github external
export function combineFiles(link, key) {
  const operManager = new qiniu.fop.OperationManager(mac, config);
  const saveas = encode64(`${bucket}:${link.creator}/zip/${Date.now()}/All.zip`);
  const fops = [`mkzip/4|saveas/${saveas}`];
  const options = {
    notifyURL: 'https://bugu.link/combine/callback',
    force: false
  };

  return new Promise((resolve, reject) => {
    operManager.pfop(bucket, key, fops, null, options, (err, res) => {
      err ? reject(err) : resolve(res.persistentId);
    });
  });
}