BSON_JSON_READER_NEW_FROM_FD(3)

πŸ’… BSON_JSON_READER_NEW_FROM_FD πŸ’…

okay so bestie, welcome to the libbson corner of the manual β€” section 3, the function-call section, iykyk. this one is literally about turning JSON into BSON while reading from a file descriptor, and ngl it's kind of a whole vibe. let's get into it 🫢


✨ SYNOPSIS ✨

the whole signature, exactly as it lives, no cap:

bson_json_reader_t *
bson_json_reader_new_from_fd (int fd, bool close_on_destroy);

πŸŽ€ PARAMETERS πŸŽ€

  • fd β€” an open file-descriptor. like, already open, bestie. it's giving "you handle the opening, i'll handle the converting" 🌸
  • close_on_destroy β€” a bool that decides whether close() should be called on fd when the reader is destroyed. so you're telling it: when this thing gets yeeted, do we also shut the door behind us or nah? πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

so what it does: creates a brand-new JSON to BSON converter that will be reading from the file-descriptor fd. that's it, that's the whole gig β€” you hand it a descriptor, it hands you back a converter that slurps JSON and gives you BSON. main character energy, honestly πŸ‘‘


🌈 RETURNS 🌈

a newly allocated bson_json_reader_t β€” freshly minted, just for you ✨ β€” and it should be freed with bson_json_reader_destroy(). do not forget this part, i'm begging 😭 that's your cleanup, that's your closure, that's the end of the arc.

fr fr though, if you don't destroy it, that's a leak, and the vibe check will fail. free your reader, bestie πŸ’–

πŸ‘‘ AUTHOR πŸ‘‘

MongoDB, Inc β€” the actual authors, periodt.


2009-present, MongoDB, Inc. β€” iconic longevity, we love to see it 🌟


aaaand that's the page! 🧚 this absolute gem of a manpage is from libbson version 2.5.6, dated Oct 09, 2026 β€” so go forth, convert some JSON, and remember to bson_json_reader_destroy() on your way out. mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from