diff --git a/src/api/embed_helpers.cc b/src/api/embed_helpers.cc index 6fac48d1b534d2..14d2a20c1c18d9 100644 --- a/src/api/embed_helpers.cc +++ b/src/api/embed_helpers.cc @@ -302,6 +302,11 @@ EmbedderSnapshotData::Pointer EmbedderSnapshotData::BuiltinSnapshotData() { EmbedderSnapshotData::Pointer EmbedderSnapshotData::FromBlob( const std::vector& in) { + return FromBlob(std::string_view(in.data(), in.size())); +} + +EmbedderSnapshotData::Pointer EmbedderSnapshotData::FromBlob( + std::string_view in) { SnapshotData* snapshot_data = new SnapshotData(); CHECK_EQ(snapshot_data->data_ownership, SnapshotData::DataOwnership::kOwned); EmbedderSnapshotData::Pointer result{ diff --git a/src/node.h b/src/node.h index b041a20318145b..58c021f67e92c3 100644 --- a/src/node.h +++ b/src/node.h @@ -537,6 +537,7 @@ class EmbedderSnapshotData { // If the snapshot is invalid, this returns an empty pointer. static Pointer FromFile(FILE* in); static Pointer FromBlob(const std::vector& in); + static Pointer FromBlob(std::string_view in); // Write this EmbedderSnapshotData object to an output file. // Calling this method will not close the FILE* handle.