diff --git a/src/api/embed_helpers.cc b/src/api/embed_helpers.cc index 1a2cb29993057f..34de89a8dc0398 100644 --- a/src/api/embed_helpers.cc +++ b/src/api/embed_helpers.cc @@ -315,6 +315,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.