我知道这是一个非常基本的问题,但我似乎无法在任何地方找到答案。
如果我有这样的字符串向量:
module.exports.upload = function(req, res) {
var busboy = new Busboy({ headers: req.headers });
busboy.on('file', function (fieldname, file, filename, encoding, mimetype) {
pipetoS3(file, guid + '_' + filename, mimetype, hash, function (err, result) {
if (err) {
console.log(err);
} else {
console.log("success!");
}
});
});
}
const pipetoS3 = function(readStream, key, mimetype, hash, callback) {
//var compress = zlib.createGzip();
var upload = s3Stream.upload({
Bucket: "mybucket",
Key: hash + '/' + key,
ACL: "public-read",
ContentType: mimetype
});
// Optional configuration
upload.maxPartSize(20971520); // 20 MB
upload.concurrentParts(5);
// Handle errors.
upload.on('error', function (error) {
console.log(error);
});
upload.on('uploaded', function (details) {
console.log('success!');
});
// Pipe the incoming filestream through compression, and up to S3.
//readStream.pipe(compress).pipe(upload);
readStream.pipe(upload);
}
我想检查哪些元素等于" b"或者" d"确切地说,所以不使用grep,我该怎么办?
我期待的是:
a <- c("a", "b", "bb", "c", "d", "dd", "e")
得到这个结果:
a == "b" || "d"
显然命令不起作用,我不知道如何使用&#34;或&#34;在这种情况下。
谢谢!