Add size to metadata response (Stream/Buffer only) #695

This commit is contained in:
Lovell Fuller
2018-10-02 18:05:08 +01:00
parent 17f942c802
commit db4df6f0b2
5 changed files with 21 additions and 3 deletions

View File

@@ -123,6 +123,9 @@ class MetadataWorker : public Nan::AsyncWorker {
// Metadata Object
v8::Local<v8::Object> info = New<v8::Object>();
Set(info, New("format").ToLocalChecked(), New<v8::String>(baton->format).ToLocalChecked());
if (baton->input->bufferLength > 0) {
Set(info, New("size").ToLocalChecked(), New<v8::Uint32>(static_cast<uint32_t>(baton->input->bufferLength)));
}
Set(info, New("width").ToLocalChecked(), New<v8::Uint32>(baton->width));
Set(info, New("height").ToLocalChecked(), New<v8::Uint32>(baton->height));
Set(info, New("space").ToLocalChecked(), New<v8::String>(baton->space).ToLocalChecked());