我有一张图片,根据API reference,它需要以 X= IntVar()
X= miEntry2.get()
X= int(X)
的身份进入API调用:
stream.Readable
我已经尝试了几个小时,但似乎无法理解。我目前正在尝试此操作,但是收到一条错误消息,提示未实现_read()方法:
function addFaceFromStream(personGroupId: string, personId: string, image: stream.Readable, options?: Object)
错误:
let childImages = new FileSet("c*.jpg").files // returns a string[]
// Add images to the person group person "child"
for (let chImage of childImages) {
// Returns a Promise<PersistedFace>
await client.personGroupPerson.addFaceFromStream(PERSON_GROUP_ID,
child.personId, new stream.Readable().push(chImage).push(null))
.then((face) => {
console.log('ID ' + face.persistedFaceId + ' was added to a person group person called Child.')
})
}
在人们创建Readable流之后,人们一直在使用pipe()的情况下,我一直看到这种类似的方式,但是我不需要为写操作做准备(如果我正确理解了pipe)。它只需要是一个可读流。
答案 0 :(得分:0)
我在一个隐蔽的文件中找到了它。这有效:
const createReadStream = require('fs').createReadStream
let childImages = new FileSet("c*.jpg").files
// Add images to the person group person "child"
for (let chImage of childImages) {
// Returns a Promise<PersistedFace>
await client.personGroupPerson.addFaceFromStream(PERSON_GROUP_ID,
child.personId, () => createReadStream(chImage))
.then((face) => {
console.log('ID ' + face.persistedFaceId + ' was added to a person group person called Child.')
})
}