diff --git a/change/react-native-windows-ea809b99-bf6d-4902-9c4f-5b35c6a7996f.json b/change/react-native-windows-ea809b99-bf6d-4902-9c4f-5b35c6a7996f.json
new file mode 100644
index 00000000000..2f693b64b96
--- /dev/null
+++ b/change/react-native-windows-ea809b99-bf6d-4902-9c4f-5b35c6a7996f.json
@@ -0,0 +1,7 @@
+{
+ "type": "prerelease",
+ "comment": "Use correct data types in FileReaderTurboModule::ReadAs*",
+ "packageName": "react-native-windows",
+ "email": "julio.rocha@microsoft.com",
+ "dependentChangeType": "patch"
+}
diff --git a/vnext/Shared/Modules/FileReaderModule.cpp b/vnext/Shared/Modules/FileReaderModule.cpp
index 09db7bdd4fd..4be2abb0194 100644
--- a/vnext/Shared/Modules/FileReaderModule.cpp
+++ b/vnext/Shared/Modules/FileReaderModule.cpp
@@ -126,21 +126,26 @@ void FileReaderTurboModule::Initialize(msrn::ReactContext const &reactContext) n
}
///
-///
-/// Array of arguments passed from the JavaScript layer.
-/// [0] - dynamic blob object { blobId, offset, size[, type] }
+///
+/// Blob object with the following fields:
+/// - blobId
+/// - offset
+/// - size
+/// - type (optional)
+///
+///
+/// Either resolves or rejects the current method with a given text message.
///
///
void FileReaderTurboModule::ReadAsDataUrl(msrn::JSValue &&data, msrn::ReactPromise &&result) noexcept {
- auto &array = data.AsArray();
- auto &blob = data[0].AsObject();
+ auto &blob = data.AsObject();
auto blobId = blob["blobId"].AsString();
auto offset = blob["offset"].AsInt64();
auto size = blob["size"].AsInt64();
auto typeItr = blob.find("type");
string type{};
- if (typeItr == blob.end()) { // TODO: .items() ?
+ if (typeItr == blob.end()) {
type = "application/octet-stream";
} else {
type = (*typeItr).second.AsString();
@@ -155,20 +160,26 @@ void FileReaderTurboModule::ReadAsDataUrl(msrn::JSValue &&data, msrn::ReactPromi
[&result](string &&message) { result.Reject(winrt::to_hstring(std::move(message)).c_str()); });
}
-/// TODO: update (folly not used)
-///
-/// Array of arguments passed from the JavaScript layer.
-/// [0] - dynamic blob object { blobId, offset, size }
-/// [1] - string encoding
-///
+///
+///
+/// Blob object with the following fields:
+/// - blobId
+/// - offset
+/// - size
+/// - type (optional)
+///
+///
+/// Text encoding to proces data with.
+///
+///
+/// Either resolves or rejects the current method with a given text message.
+///
///
void FileReaderTurboModule::ReadAsText(
msrn::JSValue &&data,
string &&encoding,
msrn::ReactPromise &&result) noexcept {
- auto &args = data.AsArray();
- auto &blob = args[0].AsObject();
-
+ auto &blob = data.AsObject();
auto blobId = blob["blobId"].AsString();
auto offset = blob["offset"].AsInt64();
auto size = blob["size"].AsInt64();