Not able to receive Microsoft Word/Excel in REST Call

Hello All,

Currently I am facing an issue while writing file that are of Microsoft Word or Excel.

the scenario is like UI (Angular JS) is doing file upload and they are calling my REST (POST) service to send the same, when I am getting the data it is coming as HTTPInputStream which is considered as ContentStream I am passing the input in the StreamToFile service that file is getting created in the local directory but the content of the same is not readable(the content is like alaphanumeric/Binary)

But when I am getting PDF content in the same and calling the same service the file is getting is created successfully and is in readable format.

Please suggest how i can get My IS ver9.9 and doing in the localhost only.