How can null characters in a string be ignored?

I am getting a 12 character string value with a terminating character over TCP/IP. But I get a data type error in the debug message. "TypeError: The argument 'newPath' must be a string or Uint8Array without null bytes. Received 'D:registration42026659000Bx00.ravi'. What could be the reason? Regards
image

somewhere in your flow you append d:\ and ???.ravi to that string right?

It certainly looks like the ??? is null

Show us more info like your flow or any function code that generates that file name

[
    {
        "id": "9503357ecd6ba5f6",
        "type": "tcp in",
        "z": "ea87b1398b776bca",
        "name": "L2 COIL ID",
        "server": "server",
        "host": "",
        "port": "2001",
        "datamode": "stream",
        "datatype": "utf8",
        "newline": "",
        "topic": "",
        "trim": false,
        "base64": false,
        "tls": "",
        "x": 140,
        "y": 380,
        "wires": [
            [
                "2ba89f82.e7991",
                "a7b2c1d1fe0681e5",
                "7a876ca634443420"
            ]
        ]
    },
    {
        "id": "7a876ca634443420",
        "type": "delay",
        "z": "ea87b1398b776bca",
        "name": "Record out time for file saving.",
        "pauseType": "delay",
        "timeout": "90",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 530,
        "y": 440,
        "wires": [
            [
                "33e06930.8b5856"
            ]
        ]
    },
    {
        "id": "33e06930.8b5856",
        "type": "fs-ops-dir",
        "z": "ea87b1398b776bca",
        "name": "",
        "path": "D:\\cam",
        "pathType": "str",
        "filter": "*.ravi",
        "filterType": "str",
        "dir": "files[0]",
        "dirType": "msg",
        "x": 740,
        "y": 440,
        "wires": [
            [
                "567fa9ed.c8bd88"
            ]
        ]
    },
    {
        "id": "567fa9ed.c8bd88",
        "type": "function",
        "z": "ea87b1398b776bca",
        "name": "",
        "func": "msg.test123 = msg.payload+\".ravi\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 890,
        "y": 440,
        "wires": [
            [
                "363603f0.472b6c"
            ]
        ]
    },
    {
        "id": "363603f0.472b6c",
        "type": "fs-ops-move",
        "z": "ea87b1398b776bca",
        "name": "",
        "sourcePath": "D:\\cam",
        "sourcePathType": "str",
        "sourceFilename": "files[0]",
        "sourceFilenameType": "msg",
        "destPath": "D:\\kayit",
        "destPathType": "str",
        "destFilename": "test123",
        "destFilenameType": "msg",
        "link": false,
        "x": 1060,
        "y": 440,
        "wires": [
            [
                "7be896a9b5f97561"
            ]
        ]
    },
    {
        "id": "7be896a9b5f97561",
        "type": "debug",
        "z": "ea87b1398b776bca",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1280,
        "y": 440,
        "wires": []
    }
]

I think that you need to trim the input msg.payload string, it appears to have a spurious null on the end.

You can do that using a function node and javascript or using a change node using JSONata.